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

Method destroy

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

Terminate all workers and reject any outstanding parses.

()

Source from the content-addressed store, hash-verified

440
441 /** Terminate all workers and reject any outstanding parses. */
442 async destroy(): Promise<void> {
443 if (this.destroyed) return;
444 this.destroyed = true;
445 const ws = [...this.workers];
446 this.workers.clear();
447 this.pending.clear();
448 this.parseCounts.clear();
449 this.idle = [];
450 for (const job of [...this.inflight.values(), ...this.queue]) {
451 this.settle(job, undefined, new Error('parse pool destroyed'));
452 }
453 this.inflight.clear();
454 this.queue = [];
455 await Promise.all(ws.map((w) => Promise.resolve(w.terminate()).catch(() => { /* already gone */ })));
456 }
457}

Callers 1

indexAllMethod · 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