From c61b89fd413b3a8f3782981509d21186bef82a1f Mon Sep 17 00:00:00 2001 From: kim Date: Mon, 10 Nov 2025 13:07:34 +0100 Subject: [performance] remove hard reliance on .Cached field to indicate whether media / emoji is cached (#4545) This removes our hard reliance on the `.Cached` field of media and emojis to determine whether it exists in storage. We still make use of it as a useful flag to know whether to even bother checking storage, but we ultimately rely on the `ErrNotFound` response of storage to determine whether the media exists and needs recaching. This now removes our hard reliance on performing the `FixCacheStatus()` cleanup operations for media and emojis, which should reduce a whole bunch of S3 storage driver calls (thus, reducing cost for metered S3 buckets). Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4545 Co-authored-by: kim Co-committed-by: kim --- cmd/gotosocial/action/admin/media/prune/all.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/gotosocial/action/admin/media/prune/all.go b/cmd/gotosocial/action/admin/media/prune/all.go index f030517e7..a6352b298 100644 --- a/cmd/gotosocial/action/admin/media/prune/all.go +++ b/cmd/gotosocial/action/admin/media/prune/all.go @@ -52,13 +52,8 @@ func All(ctx context.Context) error { days := config.GetMediaRemoteCacheDays() // Perform the actual pruning with logging. - prune.cleaner.Media().All(ctx, days) - prune.cleaner.Emoji().All(ctx, days) - - // Perform a cleanup of storage (for removed local dirs). - if err := prune.storage.Storage.Clean(ctx); err != nil { - log.Error(ctx, "error cleaning storage: %v", err) - } + prune.cleaner.Media().AllAndFix(ctx, days) + prune.cleaner.Emoji().AllAndFix(ctx, days) return nil } -- cgit v1.3