fix(artwork): broadcast refresh for stale-found artwork too

This commit is contained in:
Deluan 2026-07-22 20:57:08 -04:00
parent 05ba549843
commit 3a9dadfe34
2 changed files with 6 additions and 1 deletions

View File

@ -143,7 +143,8 @@ func (w *Worker) drain(ctx context.Context, concurrency int) (int, error) {
defer wg.Done()
defer func() { <-sem }()
defer w.release(it)
if w.process(ctx, it) == outcomeFound {
// foundStale also wrote a served state row, so it must refresh the UI too.
if out := w.process(ctx, it); out == outcomeFound || out == outcomeFoundStale {
foundMu.Lock()
found = append(found, it)
foundMu.Unlock()

View File

@ -222,6 +222,10 @@ var _ = Describe("Worker", func() {
ia, err := artRepo.GetItemArtwork("al", "alstale", model.ImageTypePrimary)
Expect(err).ToNot(HaveOccurred())
Expect(ia.Source).To(Equal("folder"), "the fallback art is served meanwhile")
evts := broker.getEvents()
Expect(evts).To(HaveLen(1), "the served fallback art must live-refresh the UI")
Expect(evts[0].(*events.RefreshResource).Data(evts[0])).To(ContainSubstring("alstale"))
})
It("keeps a row re-enqueued between dequeue and delete", func() {