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

Method destroy

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

Terminate all workers and reject any outstanding parses.

()

Source from the content-addressed store, hash-verified

343
344 /** Terminate all workers and reject any outstanding parses. */
345 async destroy(): Promise<void> {
346 if (this.destroyed) return;
347 this.destroyed = true;
348 const ws = [...this.workers];
349 this.workers.clear();
350 this.pending.clear();
351 this.parseCounts.clear();
352 this.idle = [];
353 for (const job of [...this.inflight.values(), ...this.queue]) {
354 this.settle(job, undefined, new Error('parse pool destroyed'));
355 }
356 this.inflight.clear();
357 this.queue = [];
358 await Promise.all(ws.map((w) => Promise.resolve(w.terminate()).catch(() => { /* already gone */ })));
359 }
360}

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