Web: a job worker that fails to start fails its job (#216)
worker.js left a rejected start (its async init) unhandled, which a page's Worker error event doesn't see: the page waited for "ready" forever and the render stayed pending until cancelled. The failed start is now re-raised where the page's onerror sees it, like the other worker failures; the job fails with the error and the worker is terminated. Test: apps/effectcraft-web/tests/workers.mjs (worker.js with a stub module whose init rejects; host.js with a worker whose start fails). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gnTnH3Jmk5zr4tMq1Mc9f
This commit is contained in:
@@ -30,6 +30,9 @@ self.onmessage = (e) => {
|
||||
else await ec.workerJobInit(!!m.gpu);
|
||||
self.postMessage({ type: "ready" });
|
||||
})();
|
||||
// A failed start is re-raised outside the promise so the page's `onerror` sees it: its job
|
||||
// fails instead of waiting for "ready" forever (#216).
|
||||
ready.catch((err) => setTimeout(() => { throw err; }));
|
||||
return;
|
||||
}
|
||||
// A failure (a panic) is re-raised outside the queue so the page's `onerror` sees it, as
|
||||
|
||||
Reference in New Issue
Block a user