diff options
| author | 2025-11-10 13:07:34 +0100 | |
|---|---|---|
| committer | 2025-11-17 14:14:57 +0100 | |
| commit | c61b89fd413b3a8f3782981509d21186bef82a1f (patch) | |
| tree | 503bc2d83cf7d5ea35ef974ec2c5ae9050a3a074 /internal/processing/admin | |
| parent | [chore] update dependencies (#4547) (diff) | |
| download | gotosocial-c61b89fd413b3a8f3782981509d21186bef82a1f.tar.xz | |
[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 <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/processing/admin')
| -rw-r--r-- | internal/processing/admin/media.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/processing/admin/media.go b/internal/processing/admin/media.go index 785ee0e98..11394bbed 100644 --- a/internal/processing/admin/media.go +++ b/internal/processing/admin/media.go @@ -56,11 +56,11 @@ func (p *Processor) MediaPrune(ctx context.Context, mediaRemoteCacheDays int) gt return gtserror.NewErrorBadRequest(err, err.Error()) } - // Start background task performing all media cleanup tasks. go func() { - ctx := context.Background() - p.cleaner.Media().All(ctx, mediaRemoteCacheDays) - p.cleaner.Emoji().All(ctx, mediaRemoteCacheDays) + // Start background task performing all media cleanup tasks. + ctx := gtscontext.WithValues(context.Background(), ctx) + p.cleaner.Media().AllAndFix(ctx, mediaRemoteCacheDays) + p.cleaner.Emoji().AllAndFix(ctx, mediaRemoteCacheDays) }() return nil |
