mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-23 02:32:12 +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
|
@ -68,7 +68,7 @@ func (m *manager) pruneOneLocal(ctx context.Context, attachment *gtsmodel.MediaA
|
||||||
if attachment.File.Path != "" {
|
if attachment.File.Path != "" {
|
||||||
// delete the full size attachment from storage
|
// delete the full size attachment from storage
|
||||||
logrus.Tracef("pruneOneLocal: deleting %s", attachment.File.Path)
|
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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ func (m *manager) pruneOneLocal(ctx context.Context, attachment *gtsmodel.MediaA
|
||||||
if attachment.Thumbnail.Path != "" {
|
if attachment.Thumbnail.Path != "" {
|
||||||
// delete the thumbnail from storage
|
// delete the thumbnail from storage
|
||||||
logrus.Tracef("pruneOneLocal: deleting %s", attachment.Thumbnail.Path)
|
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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ func (suite *PruneUnusedLocalTestSuite) TestPruneOneNonExistent() {
|
||||||
media, err := suite.db.GetAttachmentByID(ctx, testAttachment.ID)
|
media, err := suite.db.GetAttachmentByID(ctx, testAttachment.ID)
|
||||||
suite.NoError(err)
|
suite.NoError(err)
|
||||||
suite.True(media.Cached)
|
suite.True(media.Cached)
|
||||||
err = suite.storage.Delete(media.File.Path)
|
err = suite.storage.Delete(ctx, media.File.Path)
|
||||||
suite.NoError(err)
|
suite.NoError(err)
|
||||||
|
|
||||||
// Now attempt to prune for item with db entry no file
|
// Now attempt to prune for item with db entry no file
|
||||||
|
|
Loading…
Reference in a new issue