(w: ParsePoolWorker, job: ParseJob)
| 359 | } |
| 360 | |
| 361 | private dispatch(w: ParsePoolWorker, job: ParseJob): void { |
| 362 | this.inflight.set(w, job); |
| 363 | this.parseCounts.set(w, (this.parseCounts.get(w) ?? 0) + 1); |
| 364 | // Scale the timeout for large files: base + 10s per 100KB (matches the |
| 365 | // original single-worker formula so pathological-file behaviour is unchanged). |
| 366 | const timeoutMs = resolveParseBudgetMs(this.parseTimeoutMs, job.task.content.length); |
| 367 | job.budgetMs = timeoutMs; |
| 368 | job.timer = setTimeout(() => this.onTimeout(w, job, timeoutMs), timeoutMs); |
| 369 | job.timer.unref?.(); |
| 370 | w.postMessage({ |
| 371 | type: 'parse', |
| 372 | id: job.id, |
| 373 | filePath: job.task.filePath, |
| 374 | content: job.task.content, |
| 375 | frameworkNames: job.task.frameworkNames, |
| 376 | language: job.task.language, |
| 377 | }); |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * The base timer fired with no result processed yet. Do NOT kill or settle: |
no test coverage detected