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

Method onMessage

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

Source from the content-addressed store, hash-verified

217 }
218
219 private onMessage(w: PoolWorker, m: WorkerMessage): void {
220 if (!m) return;
221 if (m.type === 'ready') {
222 this.pendingWorkers.delete(w);
223 if (m.ok === false) this.totalCrashes++; // hard open failure
224 else this.everReady = true;
225 this.idle.push(w);
226 this.drain();
227 return;
228 }
229 if (m.type === 'result') {
230 const job = this.inflight.get(w);
231 this.inflight.delete(w);
232 this.idle.push(w);
233 if (job) this.settle(job, m.result ?? busyGuidance(0));
234 this.drain();
235 }
236 }
237
238 // A worker died (crash hook, OOM, segfault, exit≠0). Respawn a replacement and
239 // 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