(w: ParsePoolWorker, job: ParseJob)
| 468 | } |
| 469 | |
| 470 | private dispatch(w: ParsePoolWorker, job: ParseJob): void { |
| 471 | this.inflight.set(w, job); |
| 472 | this.parseCounts.set(w, (this.parseCounts.get(w) ?? 0) + 1); |
| 473 | // Scale the timeout for large files: base + 10s per 100KB (matches the |
| 474 | // original single-worker formula so pathological-file behaviour is unchanged). |
| 475 | const timeoutMs = resolveParseBudgetMs(this.parseTimeoutMs, job.task.content.length); |
| 476 | job.budgetMs = timeoutMs; |
| 477 | job.timer = setTimeout(() => this.onTimeout(w, job, timeoutMs), timeoutMs); |
| 478 | job.timer.unref?.(); |
| 479 | w.postMessage({ |
| 480 | type: 'parse', |
| 481 | id: job.id, |
| 482 | filePath: job.task.filePath, |
| 483 | content: job.task.content, |
| 484 | frameworkNames: job.task.frameworkNames, |
| 485 | language: job.task.language, |
| 486 | }); |
| 487 | } |
| 488 | |
| 489 | /** |
| 490 | * The base timer fired with no result processed yet. Do NOT kill or settle: |
no test coverage detected