summaryrefslogtreecommitdiff
path: root/internal/processing/admin
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-02-11 12:48:38 +0100
committerLibravatar GitHub <noreply@github.com>2023-02-11 12:48:38 +0100
commit40bc03e71789523ec0f3cc4ae9f8532430832cd4 (patch)
tree9a2baceffea0b80d1701b636eb19107b96e70fd3 /internal/processing/admin
parent[performance] remove throttling timers (#1466) (diff)
downloadgotosocial-40bc03e71789523ec0f3cc4ae9f8532430832cd4.tar.xz
[chore/performance] Update media prune logic, add extra CLI command (#1474)v0.7.0-rc2
* start updating media prune stuff a wee bit * continue prune / uncache work * more tidying + consistency stuff * add prune CLI command * docs * arg
Diffstat (limited to 'internal/processing/admin')
-rw-r--r--internal/processing/admin/mediaprune.go31
1 files changed, 4 insertions, 27 deletions
diff --git a/internal/processing/admin/mediaprune.go b/internal/processing/admin/mediaprune.go
index b6e7ae30f..c8157d576 100644
--- a/internal/processing/admin/mediaprune.go
+++ b/internal/processing/admin/mediaprune.go
@@ -23,7 +23,6 @@ import (
"fmt"
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
- "github.com/superseriousbusiness/gotosocial/internal/log"
)
func (p *processor) MediaPrune(ctx context.Context, mediaRemoteCacheDays int) gtserror.WithCode {
@@ -32,32 +31,10 @@ func (p *processor) MediaPrune(ctx context.Context, mediaRemoteCacheDays int) gt
return gtserror.NewErrorBadRequest(err, err.Error())
}
- go func() {
- pruned, err := p.mediaManager.PruneAllRemote(context.Background(), mediaRemoteCacheDays)
- if err != nil {
- log.Errorf("MediaPrune: error pruning remote cache: %s", err)
- } else {
- log.Infof("MediaPrune: pruned %d remote cache entries", pruned)
- }
- }()
-
- go func() {
- pruned, err := p.mediaManager.PruneUnusedLocalAttachments(context.Background())
- if err != nil {
- log.Errorf("MediaPrune: error pruning unused local cache: %s", err)
- } else {
- log.Infof("MediaPrune: pruned %d unused local cache entries", pruned)
- }
- }()
-
- go func() {
- pruned, err := p.mediaManager.PruneAllMeta(context.Background())
- if err != nil {
- log.Errorf("MediaPrune: error pruning meta: %s", err)
- } else {
- log.Infof("MediaPrune: pruned %d meta entries", pruned)
- }
- }()
+ if err := p.mediaManager.PruneAll(ctx, mediaRemoteCacheDays, false); err != nil {
+ err = fmt.Errorf("MediaPrune: %w", err)
+ return gtserror.NewErrorInternalError(err)
+ }
return nil
}