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

Method destroy

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

509 * worker still on its way out is waited for, not left to end with the process.
510 */
511 async destroy(): Promise<void> {
512 if (this.destroyed) return;
513 this.destroyed = true;
514 this.clearIdleShrink();
515 const ws = [...this.workers];
516 this.workers.clear();
517 this.pendingWorkers.clear();
518 this.idle = [];
519 for (const job of [...this.inflight.values(), ...this.queue]) {
520 this.settle(job, { isError: true, content: [{ type: 'text', text: 'codegraph is shutting down; retry shortly.' }] });
521 }
522 this.inflight.clear();
523 this.queue = [];
524 await Promise.all([
525 ...ws.map((w) => this.terminateStarted(w)),
526 ...[...this.retiring.values()].map((retirement) => retirement.gone),
527 ]);
528 }
529}

Callers 15

finishFunction · 0.45
stopMethod · 0.45
handleConnectionMethod · 0.45
fireFunction · 0.45
onStreamEndMethod · 0.45
stopMethod · 0.45
runProxyFunction · 0.45
connectWithHelloFunction · 0.45
shutdownFunction · 0.45
connectDaemonFunction · 0.45
onDaemonLostFunction · 0.45
teardownFunction · 0.45

Calls 6

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

Tested by

no test coverage detected