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

Method destroy

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

522 * worker still on its way out is waited for, not left to end with the process.
523 */
524 async destroy(): Promise<void> {
525 if (this.destroyed) return;
526 this.destroyed = true;
527 this.clearIdleShrink();
528 const ws = [...this.workers];
529 this.workers.clear();
530 this.pendingWorkers.clear();
531 this.idle = [];
532 for (const job of [...this.inflight.values(), ...this.queue]) {
533 this.settle(job, { isError: true, content: [{ type: 'text', text: 'codegraph is shutting down; retry shortly.' }] });
534 }
535 this.inflight.clear();
536 this.queue = [];
537 await Promise.all([
538 ...ws.map((w) => this.terminateStarted(w)),
539 ...[...this.retiring.values()].map((retirement) => retirement.gone),
540 ]);
541 }
542}

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