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

Method dispatch

src/extraction/parse-pool.ts:266–282  ·  view source on GitHub ↗
(w: ParsePoolWorker, job: ParseJob)

Source from the content-addressed store, hash-verified

264 }
265
266 private dispatch(w: ParsePoolWorker, job: ParseJob): void {
267 this.inflight.set(w, job);
268 this.parseCounts.set(w, (this.parseCounts.get(w) ?? 0) + 1);
269 // Scale the timeout for large files: base + 10s per 100KB (matches the
270 // original single-worker formula so pathological-file behaviour is unchanged).
271 const timeoutMs = this.parseTimeoutMs + Math.floor(job.task.content.length / 100_000) * 10_000;
272 job.timer = setTimeout(() => this.onTimeout(w, job, timeoutMs), timeoutMs);
273 job.timer.unref?.();
274 w.postMessage({
275 type: 'parse',
276 id: job.id,
277 filePath: job.task.filePath,
278 content: job.task.content,
279 frameworkNames: job.task.frameworkNames,
280 language: job.task.language,
281 });
282 }
283
284 private onTimeout(w: ParsePoolWorker, job: ParseJob, ms: number): void {
285 if (job.settled || !this.workers.has(w)) return;

Callers 1

drainMethod · 0.95

Calls 4

onTimeoutMethod · 0.95
setMethod · 0.80
getMethod · 0.65
postMessageMethod · 0.65

Tested by

no test coverage detected