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

Method replaceIfHeavy

src/mcp/query-pool.ts:368–375  ·  view source on GitHub ↗

* The last check on a kept worker: one that still holds a lot after its trim * is ended like the rest, with one clean worker in its place, so that keeping * a worker can't keep hold of what a large query left behind. Calls that come * while the clean one starts are served in process. Back a

(w: PoolWorker, heldBytes: number)

Source from the content-addressed store, hash-verified

366 * is left alone, and judged at the next shrink.
367 */
368 private replaceIfHeavy(w: PoolWorker, heldBytes: number): void {
369 if (heldBytes <= this.idleKeepBytes || !this.quiescent || this.workers.size !== 1) return;
370 this.workers.clear();
371 this.idle = [];
372 this.everReady = false;
373 this.retire(w);
374 this.spawnOne();
375 }
376
377 /**
378 * Ask an idle worker to exit by itself: it closes its connections and

Callers 1

onMessageMethod · 0.95

Calls 3

retireMethod · 0.95
spawnOneMethod · 0.95
clearMethod · 0.45

Tested by

no test coverage detected