Keep refreshing while the storyboard audio is being prepared

The page polls only while it believes something is working, and preparing
the reel was not on that list - so the progress froze at whatever the last
manual refresh had seen (5/20) while the job ran happily to completion.

Also: treat a reel job older than 15 minutes as gone, the way cuts already
are, so a worker restart cannot leave the button disabled for ever; and
start playing automatically once preparation finishes, since "Prepare and
play" promised both.
This commit is contained in:
gator 2026-09-17 18:24:19 +00:00
parent 153c38e6b8
commit acfc51b2d9

View file

@ -179,6 +179,16 @@
return s.writing || s.drawing || s.filming; });
}
// Preparing the storyboard audio is work too. Without this the page stops
// polling and the progress sits at whatever it last happened to see.
function busyReel() {
var st = String(PKG.reel_state || "");
if (!st || st === "ready" || /^failed/.test(st)) return false;
var t = Date.parse(PKG.reel_started || "");
if (!t) return true;
return (Date.now() - t) < 15 * 60 * 1000; // older than that is gone
}
async function load() {
var r = await api("run_status", { run_id: runId });
if (!r.ok) { showMsg("msg", r.error || "Could not load that run."); return; }
@ -194,7 +204,7 @@
}
function tick() {
var busy = DRAFTS.some(busyDraft) || busyRun() || busyShots();
var busy = DRAFTS.some(busyDraft) || busyRun() || busyShots() || busyReel();
if (busy && !timer) timer = setInterval(refresh, 5000);
if (!busy && timer) { clearInterval(timer); timer = null; }
}