Tear down a worker that has hit its recycle threshold and replace it. Not a * crash, so it doesn't count against the budget.
(w: ParsePoolWorker)
| 427 | /** Tear down a worker that has hit its recycle threshold and replace it. Not a |
| 428 | * crash, so it doesn't count against the budget. */ |
| 429 | private recycle(w: ParsePoolWorker): void { |
| 430 | this.log(`Recycling worker after ${this.parseCounts.get(w)} parses (heap: ${Math.round(process.memoryUsage().rss / 1024 / 1024)}MB RSS)`); |
| 431 | this.removeWorker(w); |
| 432 | // Fire-and-forget: worker.terminate() can hang if WASM is wedged. |
| 433 | try { void w.terminate(); } catch { /* already gone */ } |
| 434 | if (this.healthy && !this.destroyed) this.spawnOne(); |
| 435 | } |
| 436 | |
| 437 | /** The worker's grammar load is over: it reported ready, errored or exited. */ |
| 438 | private loadSettled(w: ParsePoolWorker): void { |
no test coverage detected