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

Method destroy

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

()

Source from the content-addressed store, hash-verified

367 * WORKER_START_SETTLE_MS); outstanding calls are answered first.
368 */
369 async destroy(): Promise<void> {
370 if (this.destroyed) return;
371 this.destroyed = true;
372 const ws = [...this.workers];
373 this.workers.clear();
374 this.pendingWorkers.clear();
375 this.idle = [];
376 for (const job of [...this.inflight.values(), ...this.queue]) {
377 this.settle(job, { isError: true, content: [{ type: 'text', text: 'codegraph is shutting down; retry shortly.' }] });
378 }
379 this.inflight.clear();
380 this.queue = [];
381 await Promise.all(ws.map((w) => this.terminateStarted(w)));
382 }
383}

Callers 15

finishFunction · 0.45
stopMethod · 0.45
handleConnectionMethod · 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
startPpidWatchdogFunction · 0.45

Calls 5

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

Tested by

no test coverage detected