← back to Scarlet Riverboat Masquerade
5x sweep 2: abort-timeout on archive.org fetches so a hung/down archive fails into the graceful error state (no infinite '…'); accurate error copy
d2d13412ae54b9bf6f99d10c9377f59c05298cdd · 2026-09-02 08:59:47 -0700 · Steve Abrams
Files touched
Diff
commit d2d13412ae54b9bf6f99d10c9377f59c05298cdd
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Sep 2 08:59:47 2026 -0700
5x sweep 2: abort-timeout on archive.org fetches so a hung/down archive fails into the graceful error state (no infinite '…'); accurate error copy
---
index.html | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/index.html b/index.html
index fa6af65..dbd0271 100644
--- a/index.html
+++ b/index.html
@@ -1528,6 +1528,14 @@ async function loadShow(i, opts){ if(sel) sel.value=String(i); return loadShowRe
// Search the WHOLE Grateful Dead collection on archive.org — type anything (date, venue, city, song)
let searchTimer=null;
+// archive.org is a flaky nonprofit — abort a hung request so the UI fails gracefully
+// into the error state instead of pulsing "…" forever (5x sweep 2 fix).
+function fetchT(url, ms=9000){
+ const ctl = (typeof AbortController!=='undefined') ? new AbortController() : null;
+ const t = ctl ? setTimeout(()=>ctl.abort(), ms) : null;
+ return fetch(url, {mode:'cors', signal: ctl?ctl.signal:undefined})
+ .finally(()=>{ if(t) clearTimeout(t); });
+}
// Browse the WHOLE Grateful Dead collection — empty = most-popular shows; text and/or a year narrow it.
async function searchArchive(q){
const res=$('mrResults'); if(!res) return;
@@ -1541,7 +1549,7 @@ async function searchArchive(q){
try{
const url='https://archive.org/advancedsearch.php?q='+encodeURIComponent(query)+
'&fl[]=identifier&fl[]=title&fl[]=date&fl[]=venue&fl[]=coverage&fl[]=downloads&sort[]='+sort+'&rows=40&output=json';
- const r=await fetch(url,{mode:'cors'}); const j=await r.json();
+ const r=await fetchT(url); const j=await r.json();
const docs=(j.response&&j.response.docs)||[]; const total=(j.response&&j.response.numFound)||0;
if(!docs.length){ res.innerHTML='<div class="mr-hint">No shows found. Try a date (1977-05-08), a city, or a song.</div>'; return; }
res.innerHTML=`<div class="mr-hint">${total.toLocaleString()} shows in the archive${filters.length?' matching':''} · showing ${docs.length}</div>`;
@@ -1552,7 +1560,7 @@ async function searchArchive(q){
b.addEventListener('click',()=>loadShowRef({id:d.identifier, date:date, title:d.venue||d.title||'Grateful Dead', sub:d.coverage||''}, {play:true}));
res.appendChild(b);
});
- }catch(e){ res.innerHTML='<div class="mr-hint">Archive browse unavailable right now (open over http, not file://).</div>'; }
+ }catch(e){ res.innerHTML='<div class="mr-hint">Archive browse is unavailable right now — archive.org may be down. Try again in a bit.</div>'; }
}
function fallbackEmbed(s){
@@ -1707,7 +1715,7 @@ function buildMap(){
});
// per-year show counts → heat-color the tiles (sqrt to tame the '77/'89 spikes)
Promise.all(YEARS.map(y=>
- fetch('https://archive.org/advancedsearch.php?q='+encodeURIComponent('collection:'+src.id+' AND year:'+y)+'&rows=0&output=json',{mode:'cors'})
+ fetchT('https://archive.org/advancedsearch.php?q='+encodeURIComponent('collection:'+src.id+' AND year:'+y)+'&rows=0&output=json')
.then(r=>r.json()).then(j=>({y,n:(j.response&&j.response.numFound)||0})).catch(()=>({y,n:-1}))
)).then(rows=>{
if(mySrc!==window.MR_SRC) return; // source switched mid-flight
← 6b0db05 riverboat: rebuild year browse per UX review — tappable 44px
·
back to Scarlet Riverboat Masquerade
·
5x: report — 2 sweeps clean after archive.org fetch-timeout 111f196 →