No result after the full hard-kill window — the worker really is hung.
(w: ParsePoolWorker, job: ParseJob, totalMs: number)
| 505 | |
| 506 | /** No result after the full hard-kill window — the worker really is hung. */ |
| 507 | private onHardTimeout(w: ParsePoolWorker, job: ParseJob, totalMs: number): void { |
| 508 | if (job.settled || !this.workers.has(w)) return; |
| 509 | this.log(`TIMEOUT: ${job.task.filePath} got no result after ${totalMs}ms — killing worker`); |
| 510 | // Kill the (WASM-wedged) worker and reject this parse. A timeout isn't a |
| 511 | // crash — don't charge the budget — but the worker is gone, so spawn a |
| 512 | // replacement to keep capacity. The rejection message contains "timed out" |
| 513 | // so the orchestrator's retry pass re-attempts the file. |
| 514 | this.removeWorker(w); |
| 515 | this.inflight.delete(w); |
| 516 | try { void w.terminate(); } catch { /* already gone */ } |
| 517 | this.settle(job, undefined, new Error(`Parse timed out after ${totalMs}ms`)); |
| 518 | if (this.healthy) this.spawnOne(); |
| 519 | this.drain(); |
| 520 | } |
| 521 | |
| 522 | private drain(): void { |
| 523 | // Grow toward maxSize while queued work outstrips workers that are idle OR |