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

Method recycleWorkers

src/resolution/resolver-pool.ts:298–320  ·  view source on GitHub ↗

* Ask every worker to close and reopen its read-only connection, and wait * for all acks. MUST be called only at the pool-idle boundary (all fanned * chunks settled, next batch not yet dispatched) — the workers close their * connections in place. Why: a long-lived reader pins WAL checkpoint

()

Source from the content-addressed store, hash-verified

296 * covers the rest of the run.
297 */
298 async recycleWorkers(): Promise<void> {
299 if (this.failed) throw this.failed;
300 await Promise.all(
301 this.workers.map(
302 (pw) =>
303 new Promise<void>((resolve, reject) => {
304 const id = this.nextId++;
305 const t = setTimeout(() => {
306 if (this.recycleWaiters.delete(id)) {
307 const err = new Error('resolver worker recycle timed out');
308 this.fail(err);
309 reject(err);
310 }
311 }, 10_000);
312 this.recycleWaiters.set(id, () => {
313 clearTimeout(t);
314 resolve();
315 });
316 pw.worker.postMessage({ type: 'recycle', id });
317 })
318 )
319 );
320 }
321
322 async destroy(): Promise<void> {
323 await Promise.all(

Callers 1

Calls 5

failMethod · 0.95
allMethod · 0.65
postMessageMethod · 0.65
resolveFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected