Gaurav vashistha commited on
Commit
8f7658e
·
1 Parent(s): 2359eb3

fix: add 180s timeout watchdog to prevent infinite spinner

Browse files
stitch_continuity_dashboard/code.html CHANGED
@@ -458,8 +458,16 @@
458
  });
459
  if (!res.ok) throw new Error(res.statusText);
460
  const data = await res.json();
 
461
  const poll = setInterval(async () => {
462
- failureCount = window.fc || 0;
 
 
 
 
 
 
 
463
  try {
464
  const sRes = await fetch(`/status/${data.job_id}?t=${Date.now()}`);
465
  if (sRes.ok) {
 
458
  });
459
  if (!res.ok) throw new Error(res.statusText);
460
  const data = await res.json();
461
+ const pollStartTime = Date.now();
462
  const poll = setInterval(async () => {
463
+ // DEAD MAN'S SWITCH: 180s timeout
464
+ if (Date.now() - pollStartTime > 180000) {
465
+ clearInterval(poll);
466
+ alert("Timeout: Server took too long (3 min). Job may still be processing in background.");
467
+ btn.disabled = false;
468
+ btn.innerHTML = `<span class="material-symbols-outlined">error</span> Timeout`;
469
+ return;
470
+ }
471
  try {
472
  const sRes = await fetch(`/status/${data.job_id}?t=${Date.now()}`);
473
  if (sRes.ok) {