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

Method onMessage

src/mcp/query-pool.ts:202–218  ·  view source on GitHub ↗
(w: PoolWorker, m: WorkerMessage)

Source from the content-addressed store, hash-verified

200 }
201
202 private onMessage(w: PoolWorker, m: WorkerMessage): void {
203 if (!m) return;
204 if (m.type === 'ready') {
205 this.pendingWorkers.delete(w);
206 if (m.ok === false) this.totalCrashes++; // hard open failure
207 this.idle.push(w);
208 this.drain();
209 return;
210 }
211 if (m.type === 'result') {
212 const job = this.inflight.get(w);
213 this.inflight.delete(w);
214 this.idle.push(w);
215 if (job) this.settle(job, m.result ?? busyGuidance(0));
216 this.drain();
217 }
218 }
219
220 // A worker died (crash hook, OOM, segfault, exit≠0). Respawn a replacement and
221 // retry its in-flight job once; a job that keeps crashing workers fails

Callers 1

spawnOneMethod · 0.95

Calls 4

drainMethod · 0.95
settleMethod · 0.95
busyGuidanceFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected