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

Method destroy

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

* Terminate all workers and answer any outstanding calls gracefully. A worker * still starting up is terminated once it has started (see * WORKER_START_SETTLE_MS); outstanding calls are answered first. A retired * worker still on its way out is waited for, not left to end with the process.

()

Source from the content-addressed store, hash-verified

594 * worker still on its way out is waited for, not left to end with the process.
595 */
596 async destroy(): Promise<void> {
597 if (this.destroyed) return;
598 this.destroyed = true;
599 this.clearIdleShrink();
600 const ws = [...this.workers];
601 this.workers.clear();
602 this.pendingWorkers.clear();
603 this.idle = [];
604 for (const job of [...this.inflight.values(), ...this.queue]) {
605 this.settle(job, { isError: true, content: [{ type: 'text', text: 'codegraph is shutting down; retry shortly.' }] });
606 }
607 this.inflight.clear();
608 this.queue = [];
609 await Promise.all([
610 ...ws.map((w) => this.terminateStarted(w)),
611 ...[...this.retiring.values()].map((retirement) => retirement.gone),
612 ]);
613 }
614}

Callers 15

heldPoolFunction · 0.95
finishFunction · 0.45
stopMethod · 0.45
handleConnectionMethod · 0.45
fireFunction · 0.45
onStreamEndMethod · 0.45
stopMethod · 0.45
finishFunction · 0.45
exploreViaDaemonFunction · 0.45
connectWithHelloFunction · 0.45
shutdownFunction · 0.45
connectDaemonFunction · 0.45

Calls 6

clearIdleShrinkMethod · 0.95
settleMethod · 0.95
terminateStartedMethod · 0.95
mapMethod · 0.80
allMethod · 0.65
clearMethod · 0.45

Tested by 1

heldPoolFunction · 0.76