MCPcopy
hub / github.com/colbymchenry/codegraph / destroy

Method destroy

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

Terminate all workers and answer any outstanding calls gracefully.

()

Source from the content-addressed store, hash-verified

292
293 /** Terminate all workers and answer any outstanding calls gracefully. */
294 async destroy(): Promise<void> {
295 if (this.destroyed) return;
296 this.destroyed = true;
297 const ws = [...this.workers];
298 this.workers.clear();
299 this.pendingWorkers.clear();
300 this.idle = [];
301 for (const job of [...this.inflight.values(), ...this.queue]) {
302 this.settle(job, { isError: true, content: [{ type: 'text', text: 'codegraph is shutting down; retry shortly.' }] });
303 }
304 this.inflight.clear();
305 this.queue = [];
306 await Promise.all(ws.map((w) => Promise.resolve(w.terminate()).catch(() => { /* already gone */ })));
307 }
308}

Callers 12

onStreamEndMethod · 0.45
stopMethod · 0.45
runProxyFunction · 0.45
connectWithHelloFunction · 0.45
shutdownFunction · 0.45
onDaemonLostFunction · 0.45
teardownFunction · 0.45
startPpidWatchdogFunction · 0.45
stopMethod · 0.45
fireFunction · 0.45
httpsGetFunction · 0.45
mainFunction · 0.45

Calls 5

settleMethod · 0.95
resolveMethod · 0.80
allMethod · 0.65
terminateMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected