(w: PoolWorker, m: WorkerMessage)
| 217 | } |
| 218 | |
| 219 | private onMessage(w: PoolWorker, m: WorkerMessage): void { |
| 220 | if (!m) return; |
| 221 | if (m.type === 'ready') { |
| 222 | this.pendingWorkers.delete(w); |
| 223 | if (m.ok === false) this.totalCrashes++; // hard open failure |
| 224 | else this.everReady = true; |
| 225 | this.idle.push(w); |
| 226 | this.drain(); |
| 227 | return; |
| 228 | } |
| 229 | if (m.type === 'result') { |
| 230 | const job = this.inflight.get(w); |
| 231 | this.inflight.delete(w); |
| 232 | this.idle.push(w); |
| 233 | if (job) this.settle(job, m.result ?? busyGuidance(0)); |
| 234 | this.drain(); |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | // A worker died (crash hook, OOM, segfault, exit≠0). Respawn a replacement and |
| 239 | // retry its in-flight job once; a job that keeps crashing workers fails |
no test coverage detected