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:
parent
60ee7930ba
commit
d4c0fdf7eb
|
|
@ -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") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue