MCPcopy Index your code
hub / github.com/colbymchenry/codegraph / makePool

Function makePool

__tests__/parse-pool.test.ts:67–81  ·  view source on GitHub ↗

Build a pool with a counting fake-worker factory.

(
  size: number,
  behavior: (m: ParseMsg) => Action,
  opts: Partial<{ recycleInterval: number; parseTimeoutMs: number }> = {}
)

Source from the content-addressed store, hash-verified

65
66/** Build a pool with a counting fake-worker factory. */
67function makePool(
68 size: number,
69 behavior: (m: ParseMsg) => Action,
70 opts: Partial<{ recycleInterval: number; parseTimeoutMs: number }> = {}
71) {
72 let spawned = 0, terminated = 0;
73 const pool = new ParseWorkerPool({
74 languages: ['typescript'] as Language[],
75 size,
76 recycleInterval: opts.recycleInterval,
77 parseTimeoutMs: opts.parseTimeoutMs,
78 createWorker: () => { spawned++; return new FakeWorker(behavior, () => { terminated++; }); },
79 });
80 return { pool, counts: () => ({ spawned, terminated }) };
81}
82
83describe('resolveParsePoolSize', () => {
84 it('treats explicit 0 and 1 as a single worker (the rollback path)', () => {

Callers 1

parse-pool.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected