mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-30 20:31:09 +00:00
[chore] Update pruneOneLocal to use ctx (#684)
* update pruneOneLocal to use ctx * update test
This commit is contained in:
parent
9d0df426da
commit
de4d75246c
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue