No result after the full hard-kill window — the worker really is hung.
(w: ParsePoolWorker, job: ParseJob, totalMs: number)
| 480 | |
| 481 | /** No result after the full hard-kill window — the worker really is hung. */ |
| 482 | private onHardTimeout(w: ParsePoolWorker, job: ParseJob, totalMs: number): void { |
| 483 | if (job.settled || !this.workers.has(w)) return; |
| 484 | this.log(`TIMEOUT: ${job.task.filePath} got no result after ${totalMs}ms — killing worker`); |
| 485 | // Kill the (WASM-wedged) worker and reject this parse. A timeout isn't a |
| 486 | // crash — don't charge the budget — but the worker is gone, so spawn a |
| 487 | // replacement to keep capacity. The rejection message contains "timed out" |
| 488 | // so the orchestrator's retry pass re-attempts the file. |
| 489 | this.removeWorker(w); |
| 490 | this.inflight.delete(w); |
| 491 | try { void w.terminate(); } catch { /* already gone */ } |
| 492 | this.settle(job, undefined, new Error(`Parse timed out after ${totalMs}ms`)); |
| 493 | if (this.healthy) this.spawnOne(); |
| 494 | this.drain(); |
| 495 | } |
| 496 | |
| 497 | private drain(): void { |
| 498 | // Grow toward maxSize while queued work outstrips workers that are idle OR |