fix(explore): let a slow archive node finish, and read the 404 back
Explore's album art was almost entirely missing: 5 of 24 cards on the shelves had a cover, and those five were the ones already on disk. The Cover Art Archive answers `front-250` with a 307 to an Internet Archive storage node, and those nodes are slow. Measured against the twelve albums on Explore's own shelves, a successful fetch took 14-16 s and a failing one 13-17 s, against a client timeout of 10. So every live fetch died, and a timeout writes nothing and says nothing -- which is why this reads as "Explore has no album art" rather than as a slow upstream. The timeout is 30 s, chosen to clear the measured range: the fetch is off the critical path, so waiting costs nothing and giving up early costs the whole page. Two things beside it, both found on the way. `writeCache(mbid, nil)` has recorded "the archive has no art for this" as an empty file since it was written, and nothing has ever read it back: `readCache` returns "" for an empty file, which is indistinguishable from a miss. So every art-less release group was re-fetched from CAA on every render that asked about it. A third of the shelves are art-less, so that was a third of the page spending a live request to be told again what the last one said. `knownMissing` reads it, on both the release-group and the release path. And the frontend marked a failed fetch as permanently answered for the session, so a timed-out cover never retried within it. It drops the marker instead; a genuine 404 is now answered from disk, so re-asking one costs nothing. Measured after: 23 of 24. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MeQt5hgXg5YGoNZQ9ozG7L
This commit is contained in:
@@ -1509,9 +1509,24 @@ export class ExploreView extends ViewLifecycleMixin(LitElement) implements Conte
|
||||
if (url) {
|
||||
this.thumbnailCache.set(req.mbid, url);
|
||||
this.requestUpdate();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// An empty answer is not necessarily "there
|
||||
// is no art" — a slow Internet Archive node
|
||||
// is answered by a timeout, which looks
|
||||
// exactly the same from here. Drop the
|
||||
// in-flight marker so the next time this
|
||||
// release group is on screen it is asked
|
||||
// again; the backend records a genuine 404
|
||||
// on disk and answers that one instantly,
|
||||
// so a real miss costs nothing to re-ask.
|
||||
this.thumbnailCache.delete(req.mbid);
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {
|
||||
this.thumbnailCache.delete(req.mbid);
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
Reference in New Issue
Block a user