fix(rsplat): stop polling on 404 when job lost after server restart

In-memory gen3dJobs are lost on container restart. The poll was silently
swallowing 404s and looping forever. Now stops after 3 consecutive 404s
with a clear "server restarted" message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-16 16:51:34 -07:00
parent 60ee7930ba
commit d4c0fdf7eb
1 changed files with 14 additions and 1 deletions

View File

@ -609,10 +609,23 @@ export class FolkSplatViewer extends HTMLElement {
// Ticker keeps running — progress bar continues advancing during polling
// Poll for completion
let poll404Count = 0;
const pollInterval = setInterval(async () => {
try {
const pollRes = await fetch(`/api/3d-gen/${job_id}`);
if (!pollRes.ok) return;
if (!pollRes.ok) {
if (pollRes.status === 404 && ++poll404Count >= 3) {
// Job lost — server likely restarted
stopTicker();
clearInterval(pollInterval);
progress.style.display = "none";
status.textContent = "Job lost — server restarted. Please try again.";
actions.style.display = "flex";
submitBtn.disabled = false;
}
return;
}
poll404Count = 0;
const job = await pollRes.json() as any;
if (job.status === "complete") {