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

Method constructor

src/extraction/parse-pool.ts:193–209  ·  view source on GitHub ↗
(opts: ParseWorkerPoolOptions)

Source from the content-addressed store, hash-verified

191 private readonly grammarBuffers?: Record<string, Uint8Array>;
192
193 constructor(opts: ParseWorkerPoolOptions) {
194 this.languages = opts.languages;
195 this.grammarBuffers = opts.grammarBuffers;
196 this.maxSize = Math.max(1, Math.min(opts.size, MAX_PARSE_POOL_SIZE));
197 this.recycleInterval = opts.recycleInterval ?? DEFAULT_RECYCLE_INTERVAL;
198 this.parseTimeoutMs = opts.parseTimeoutMs ?? DEFAULT_PARSE_TIMEOUT_MS;
199 this.log = opts.log ?? (() => {});
200 if (opts.createWorker) {
201 this.createWorker = opts.createWorker;
202 } else if (opts.workerScriptPath) {
203 const scriptPath = opts.workerScriptPath;
204 this.createWorker = () => new Worker(scriptPath);
205 } else {
206 throw new Error('ParseWorkerPool requires workerScriptPath or createWorker');
207 }
208 this.spawnOne(); // one eager warm worker, ready for the first parse
209 }
210
211 /**
212 * Spawn the whole pool up front. The default demand-driven growth avoids

Callers

nothing calls this directly

Calls 1

spawnOneMethod · 0.95

Tested by

no test coverage detected