gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit de4d75246c7db3b97c87da7f54db599beb999694
parent 9d0df426da59275f7aeaf46004befe5a778da274
Author: tobi <31960611+tsmethurst@users.noreply.github.com>
Date:   Sun,  3 Jul 2022 12:18:59 +0200

[chore] Update pruneOneLocal to use ctx (#684)

* update pruneOneLocal to use ctx

* update test
Diffstat:
Minternal/media/pruneunusedlocal.go | 4++--
Minternal/media/pruneunusedlocal_test.go | 2+-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/internal/media/pruneunusedlocal.go b/internal/media/pruneunusedlocal.go @@ -68,7 +68,7 @@ func (m *manager) pruneOneLocal(ctx context.Context, attachment *gtsmodel.MediaA if attachment.File.Path != "" { // delete the full size attachment from storage logrus.Tracef("pruneOneLocal: deleting %s", attachment.File.Path) - if err := m.storage.Delete(attachment.File.Path); err != nil && err != storage.ErrNotFound { + if err := m.storage.Delete(ctx, attachment.File.Path); err != nil && err != storage.ErrNotFound { return err } } @@ -76,7 +76,7 @@ func (m *manager) pruneOneLocal(ctx context.Context, attachment *gtsmodel.MediaA if attachment.Thumbnail.Path != "" { // delete the thumbnail from storage logrus.Tracef("pruneOneLocal: deleting %s", attachment.Thumbnail.Path) - if err := m.storage.Delete(attachment.Thumbnail.Path); err != nil && err != storage.ErrNotFound { + if err := m.storage.Delete(ctx, attachment.Thumbnail.Path); err != nil && err != storage.ErrNotFound { return err } } diff --git a/internal/media/pruneunusedlocal_test.go b/internal/media/pruneunusedlocal_test.go @@ -61,7 +61,7 @@ func (suite *PruneUnusedLocalTestSuite) TestPruneOneNonExistent() { media, err := suite.db.GetAttachmentByID(ctx, testAttachment.ID) suite.NoError(err) suite.True(media.Cached) - err = suite.storage.Delete(media.File.Path) + err = suite.storage.Delete(ctx, media.File.Path) suite.NoError(err) // Now attempt to prune for item with db entry no file