feat: add cached parallel lint runner - #13
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const workerPromises = workerInputs.map((input) => spawnWorker(input)); | ||
| let aggregatedResults: ESLint.LintResult[] = []; | ||
|
|
||
| for (const workerPromise of workerPromises) { | ||
| const output = await workerPromise; | ||
| aggregatedResults = aggregatedResults.concat(output.results); |
There was a problem hiding this comment.
Avoid unhandled rejections when any worker fails
Each worker lint task is spawned and its promise stored in workerPromises, but the subsequent for loop awaits them one at a time. If any worker other than the first rejects before its turn in the loop, the rejection has no handler in that tick and Node will emit an unhandledRejection (fatal in some runtimes) before the loop ever awaits that promise. This means a fast‑failing worker can terminate the process while the other workers are still running, and the error surfaced via the loop may never execute. Await the promises collectively (e.g. await Promise.all(...)) or attach rejection handlers up front so every worker failure is observed immediately.
Useful? React with 👍 / 👎.
Summary
Testing
Codex Task