From baf933cb9f3e1053bdb61b90d7027efe9fad1bc2 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Wed, 1 Mar 2023 18:26:53 +0000 Subject: [chore] move client/federator workerpools to Workers{} (#1575) * replace concurrency worker pools with base models in State.Workers, update code and tests accordingly * improve code comment * change back testrig default log level * un-comment-out TestAnnounceTwice() and fix --------- Signed-off-by: kim Reviewed-by: tobi --- internal/processing/media/delete.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/processing/media/delete.go') diff --git a/internal/processing/media/delete.go b/internal/processing/media/delete.go index 6507fcae4..02bd6cd0d 100644 --- a/internal/processing/media/delete.go +++ b/internal/processing/media/delete.go @@ -13,7 +13,7 @@ import ( // Delete deletes the media attachment with the given ID, including all files pertaining to that attachment. func (p *Processor) Delete(ctx context.Context, mediaAttachmentID string) gtserror.WithCode { - attachment, err := p.db.GetAttachmentByID(ctx, mediaAttachmentID) + attachment, err := p.state.DB.GetAttachmentByID(ctx, mediaAttachmentID) if err != nil { if err == db.ErrNoEntries { // attachment already gone @@ -27,20 +27,20 @@ func (p *Processor) Delete(ctx context.Context, mediaAttachmentID string) gtserr // delete the thumbnail from storage if attachment.Thumbnail.Path != "" { - if err := p.storage.Delete(ctx, attachment.Thumbnail.Path); err != nil && !errors.Is(err, storage.ErrNotFound) { + if err := p.state.Storage.Delete(ctx, attachment.Thumbnail.Path); err != nil && !errors.Is(err, storage.ErrNotFound) { errs = append(errs, fmt.Sprintf("remove thumbnail at path %s: %s", attachment.Thumbnail.Path, err)) } } // delete the file from storage if attachment.File.Path != "" { - if err := p.storage.Delete(ctx, attachment.File.Path); err != nil && !errors.Is(err, storage.ErrNotFound) { + if err := p.state.Storage.Delete(ctx, attachment.File.Path); err != nil && !errors.Is(err, storage.ErrNotFound) { errs = append(errs, fmt.Sprintf("remove file at path %s: %s", attachment.File.Path, err)) } } // delete the attachment - if err := p.db.DeleteByID(ctx, mediaAttachmentID, attachment); err != nil && !errors.Is(err, db.ErrNoEntries) { + if err := p.state.DB.DeleteByID(ctx, mediaAttachmentID, attachment); err != nil && !errors.Is(err, db.ErrNoEntries) { errs = append(errs, fmt.Sprintf("remove attachment: %s", err)) } -- cgit v1.2.3