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

Method recycleWorkers

src/resolution/resolver-pool.ts:400–422  ·  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

398 * covers the rest of the run.
399 */
400 async recycleWorkers(): Promise<void> {
401 if (this.failed) throw this.failed;
402 await Promise.all(
403 this.workers.map(
404 (pw) =>
405 new Promise<void>((resolve, reject) => {
406 const id = this.nextId++;
407 const t = setTimeout(() => {
408 if (this.recycleWaiters.delete(id)) {
409 const err = new Error('resolver worker recycle timed out');
410 this.fail(err);
411 reject(err);
412 }
413 }, 10_000);
414 this.recycleWaiters.set(id, () => {
415 clearTimeout(t);
416 resolve();
417 });
418 pw.worker.postMessage({ type: 'recycle', id });
419 })
420 )
421 );
422 }
423
424 /**
425 * Ask every worker to close; each collects garbage and exits by itself (see

Callers 1

Calls 7

failMethod · 0.95
mapMethod · 0.80
allMethod · 0.65
deleteMethod · 0.65
postMessageMethod · 0.65
resolveFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected