mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-26 03:49:56 +01:00
fix(artwork): enqueue uploaded artwork only after the filename is persisted
SetImage cleared state and enqueued the bump before the caller stored the new filename, so a worker drain in that window could resolve against the old (already deleted) file and settle absent, leaving the upload unused until a later scan. Move the invalidate+enqueue into EnqueueArtwork, which each caller now invokes after the entity Put.
This commit is contained in:
parent
f4e14e9c1a
commit
66d3d23149
5 changed files with 44 additions and 8 deletions
|
|
@ -46,7 +46,11 @@ func (api *Router) uploadArtistImage() http.HandlerFunc {
|
|||
}
|
||||
ar.UploadedImage = filename
|
||||
ar.UpdatedAt = new(time.Now())
|
||||
return api.ds.Artist(ctx).Put(ar, "uploaded_image", "updated_at")
|
||||
if err := api.ds.Artist(ctx).Put(ar, "uploaded_image", "updated_at"); err != nil {
|
||||
return err
|
||||
}
|
||||
api.imgUpload.EnqueueArtwork(ctx, consts.EntityArtist, ar.ID)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@ func (api *Router) uploadRadioImage() http.HandlerFunc {
|
|||
return err
|
||||
}
|
||||
radio.UploadedImage = filename
|
||||
return api.ds.Radio(ctx).Put(radio, "UploadedImage")
|
||||
if err := api.ds.Radio(ctx).Put(radio, "UploadedImage"); err != nil {
|
||||
return err
|
||||
}
|
||||
api.imgUpload.EnqueueArtwork(ctx, consts.EntityRadio, radio.ID)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue