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

Method constructor

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

Source from the content-addressed store, hash-verified

149 private readonly log: (msg: string) => void;
150
151 constructor(opts: ParseWorkerPoolOptions) {
152 this.languages = opts.languages;
153 this.maxSize = Math.max(1, Math.min(opts.size, MAX_PARSE_POOL_SIZE));
154 this.recycleInterval = opts.recycleInterval ?? DEFAULT_RECYCLE_INTERVAL;
155 this.parseTimeoutMs = opts.parseTimeoutMs ?? DEFAULT_PARSE_TIMEOUT_MS;
156 this.log = opts.log ?? (() => {});
157 if (opts.createWorker) {
158 this.createWorker = opts.createWorker;
159 } else if (opts.workerScriptPath) {
160 const scriptPath = opts.workerScriptPath;
161 this.createWorker = () => new Worker(scriptPath);
162 } else {
163 throw new Error('ParseWorkerPool requires workerScriptPath or createWorker');
164 }
165 this.spawnOne(); // one eager warm worker, ready for the first parse
166 }
167
168 /** Pool size cap (for logging). */
169 get size(): number { return this.maxSize; }

Callers

nothing calls this directly

Calls 1

spawnOneMethod · 0.95

Tested by

no test coverage detected