Retry failed album-art fetches and keep the art cache across restarts #3

Merged
charles merged 1 commit from art-cache-fix into main 2026-08-31 17:00:28 +00:00
Owner
No description provided.
ensureArt() treated any existing map entry as settled, so a failed download left
an empty string behind for good. It runs on every strip render, so it kept being
called for the affected track and returning immediately — one blip while a track
started cost that track its cover for the life of the daemon. Retry with backoff
(4s, 8s ... capped at 5 min) instead, with an explicit inFlight flag so the
per-render calls don't spawn duplicate workers.

The cache filename was std::to_string(qHash(url)). Qt 6 randomises the string
hash seed per process, so every run picked a different name for the same URL,
re-downloaded it and left a duplicate behind — one cover was on disk three times,
from three restarts the same evening. Use a deterministic FNV-1a over the URL
bytes so the cache survives a restart.

Also validate a cached file by its JPEG/PNG signature rather than trusting any
file that exists, and write via a temp file + rename, so an interrupted write
can't leave a truncated image that would be believed forever. Same failure mode
as the Discord avatar cache.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SgxBekX2pzvfrtLQpBgGue
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/mirabox-application!3
No description provided.