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

Method destroy

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

Terminate all workers and answer any outstanding calls gracefully.

()

Source from the content-addressed store, hash-verified

310
311 /** Terminate all workers and answer any outstanding calls gracefully. */
312 async destroy(): Promise<void> {
313 if (this.destroyed) return;
314 this.destroyed = true;
315 const ws = [...this.workers];
316 this.workers.clear();
317 this.pendingWorkers.clear();
318 this.idle = [];
319 for (const job of [...this.inflight.values(), ...this.queue]) {
320 this.settle(job, { isError: true, content: [{ type: 'text', text: 'codegraph is shutting down; retry shortly.' }] });
321 }
322 this.inflight.clear();
323 this.queue = [];
324 await Promise.all(ws.map((w) => Promise.resolve(w.terminate()).catch(() => { /* already gone */ })));
325 }
326}

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