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

Method destroy

src/extraction/parse-pool.ts:461–475  ·  view source on GitHub ↗

Terminate all workers and reject any outstanding parses.

()

Source from the content-addressed store, hash-verified

459
460 /** Terminate all workers and reject any outstanding parses. */
461 async destroy(): Promise<void> {
462 if (this.destroyed) return;
463 this.destroyed = true;
464 const ws = [...this.workers];
465 this.workers.clear();
466 this.pending.clear();
467 this.parseCounts.clear();
468 this.idle = [];
469 for (const job of [...this.inflight.values(), ...this.queue]) {
470 this.settle(job, undefined, new Error('parse pool destroyed'));
471 }
472 this.inflight.clear();
473 this.queue = [];
474 await Promise.all(ws.map((w) => Promise.resolve(w.terminate()).catch(() => { /* already gone */ })));
475 }
476}

Callers 1

indexAllMethod · 0.45

Calls 5

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

Tested by

no test coverage detected