MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / recycle

Method recycle

src/extraction/parse-pool.ts:404–410  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

402 /** Tear down a worker that has hit its recycle threshold and replace it. Not a
403 * crash, so it doesn't count against the budget. */
404 private recycle(w: ParsePoolWorker): void {
405 this.log(`Recycling worker after ${this.parseCounts.get(w)} parses (heap: ${Math.round(process.memoryUsage().rss / 1024 / 1024)}MB RSS)`);
406 this.removeWorker(w);
407 // Fire-and-forget: worker.terminate() can hang if WASM is wedged.
408 try { void w.terminate(); } catch { /* already gone */ }
409 if (this.healthy && !this.destroyed) this.spawnOne();
410 }
411
412 /** The worker's grammar load is over: it reported ready, errored or exited. */
413 private loadSettled(w: ParsePoolWorker): void {

Callers 2

onMessageMethod · 0.95
recycleAllMethod · 0.95

Calls 4

removeWorkerMethod · 0.95
spawnOneMethod · 0.95
getMethod · 0.65
terminateMethod · 0.65

Tested by

no test coverage detected