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

Method dispatch

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

Source from the content-addressed store, hash-verified

340 }
341
342 private dispatch(w: ParsePoolWorker, job: ParseJob): void {
343 this.inflight.set(w, job);
344 this.parseCounts.set(w, (this.parseCounts.get(w) ?? 0) + 1);
345 // Scale the timeout for large files: base + 10s per 100KB (matches the
346 // original single-worker formula so pathological-file behaviour is unchanged).
347 const timeoutMs = this.parseTimeoutMs + Math.floor(job.task.content.length / 100_000) * 10_000;
348 job.budgetMs = timeoutMs;
349 job.timer = setTimeout(() => this.onTimeout(w, job, timeoutMs), timeoutMs);
350 job.timer.unref?.();
351 w.postMessage({
352 type: 'parse',
353 id: job.id,
354 filePath: job.task.filePath,
355 content: job.task.content,
356 frameworkNames: job.task.frameworkNames,
357 language: job.task.language,
358 });
359 }
360
361 /**
362 * The base timer fired with no result processed yet. Do NOT kill or settle:

Callers 1

drainMethod · 0.95

Calls 4

onTimeoutMethod · 0.95
getMethod · 0.65
postMessageMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected