(w: ParsePoolWorker, job: ParseJob)
| 443 | } |
| 444 | |
| 445 | private dispatch(w: ParsePoolWorker, job: ParseJob): void { |
| 446 | this.inflight.set(w, job); |
| 447 | this.parseCounts.set(w, (this.parseCounts.get(w) ?? 0) + 1); |
| 448 | // Scale the timeout for large files: base + 10s per 100KB (matches the |
| 449 | // original single-worker formula so pathological-file behaviour is unchanged). |
| 450 | const timeoutMs = resolveParseBudgetMs(this.parseTimeoutMs, job.task.content.length); |
| 451 | job.budgetMs = timeoutMs; |
| 452 | job.timer = setTimeout(() => this.onTimeout(w, job, timeoutMs), timeoutMs); |
| 453 | job.timer.unref?.(); |
| 454 | w.postMessage({ |
| 455 | type: 'parse', |
| 456 | id: job.id, |
| 457 | filePath: job.task.filePath, |
| 458 | content: job.task.content, |
| 459 | frameworkNames: job.task.frameworkNames, |
| 460 | language: job.task.language, |
| 461 | }); |
| 462 | } |
| 463 | |
| 464 | /** |
| 465 | * The base timer fired with no result processed yet. Do NOT kill or settle: |
no test coverage detected