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

Method replaceIfHeavy

src/mcp/query-pool.ts:398–405  ·  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

396 * is left alone, and judged at the next shrink.
397 */
398 private replaceIfHeavy(w: PoolWorker, heldBytes: number): void {
399 if (heldBytes <= this.idleKeepBytes || !this.quiescent || this.workers.size !== 1) return;
400 this.workers.clear();
401 this.idle = [];
402 this.everReady = false;
403 this.retire(w);
404 this.spawnOne();
405 }
406
407 /**
408 * 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