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

Method spawnOne

src/mcp/query-pool.ts:203–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201 private everReady = false;
202
203 private spawnOne(): void {
204 if (this.destroyed || this.workers.size >= this.maxSize) return;
205 let w: PoolWorker;
206 try {
207 w = this.createWorker();
208 } catch {
209 this.totalCrashes++; // counts toward the circuit breaker
210 return;
211 }
212 this.workers.add(w);
213 this.pendingWorkers.add(w);
214 w.on('message', (m) => this.onMessage(w, (m ?? {}) as WorkerMessage));
215 w.on('error', () => this.onWorkerGone(w));
216 w.on('exit', (code) => { if (code !== 0) this.onWorkerGone(w); });
217 }
218
219 private onMessage(w: PoolWorker, m: WorkerMessage): void {
220 if (!m) return;

Callers 3

constructorMethod · 0.95
onWorkerGoneMethod · 0.95
drainMethod · 0.95

Calls 3

onMessageMethod · 0.95
onWorkerGoneMethod · 0.95
onMethod · 0.65

Tested by

no test coverage detected