diff options
| author | 2022-12-08 17:35:14 +0000 | |
|---|---|---|
| committer | 2022-12-08 18:35:14 +0100 | |
| commit | e58d2d81226c4cc4110747305d083b67903d621c (patch) | |
| tree | 249f8b3f4732ccdb1e77b2d4243fafb4ee4c1c86 /cmd/gotosocial/action/admin/media | |
| parent | [chore] Remove deprecated linters (#1228) (diff) | |
| download | gotosocial-e58d2d81226c4cc4110747305d083b67903d621c.tar.xz | |
[chore] move caches to a separate State{} structure (#1078)
* move caches to a separate State{} structure
Signed-off-by: kim <grufwub@gmail.com>
* fix call to log.Panic not using formatted call
Signed-off-by: kim <grufwub@gmail.com>
* move caches to use interfaces, to make switchouts easier in future
Signed-off-by: kim <grufwub@gmail.com>
* fix rebase issue
Signed-off-by: kim <grufwub@gmail.com>
* improve code comment
Signed-off-by: kim <grufwub@gmail.com>
* fix further issues after rebase
Signed-off-by: kim <grufwub@gmail.com>
* heh
Signed-off-by: kim <grufwub@gmail.com>
* add missing license text
Signed-off-by: kim <grufwub@gmail.com>
Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'cmd/gotosocial/action/admin/media')
| -rw-r--r-- | cmd/gotosocial/action/admin/media/prune/orphaned.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/gotosocial/action/admin/media/prune/orphaned.go b/cmd/gotosocial/action/admin/media/prune/orphaned.go index 4ceb356bd..ede00dca2 100644 --- a/cmd/gotosocial/action/admin/media/prune/orphaned.go +++ b/cmd/gotosocial/action/admin/media/prune/orphaned.go @@ -27,12 +27,16 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/db/bundb" "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/media" + "github.com/superseriousbusiness/gotosocial/internal/state" gtsstorage "github.com/superseriousbusiness/gotosocial/internal/storage" ) // Orphaned prunes orphaned media from storage. var Orphaned action.GTSAction = func(ctx context.Context) error { - dbService, err := bundb.NewBunDBService(ctx) + var state state.State + state.Caches.Init() + + dbService, err := bundb.NewBunDBService(ctx, &state) if err != nil { return fmt.Errorf("error creating dbservice: %s", err) } @@ -54,7 +58,7 @@ var Orphaned action.GTSAction = func(ctx context.Context) error { return fmt.Errorf("error pruning: %s", err) } - if dry { + if dry /* dick heyyoooooo */ { log.Infof("DRY RUN: %d stored items are orphaned and eligible to be pruned", pruned) } else { log.Infof("%d stored items were orphaned and pruned", pruned) |
