feat: add maxParallel option to limit workspace build concurrency#1
Closed
jpzwarte wants to merge 4 commits into
Closed
feat: add maxParallel option to limit workspace build concurrency#1jpzwarte wants to merge 4 commits into
maxParallel option to limit workspace build concurrency#1jpzwarte wants to merge 4 commits into
Conversation
Fixes rolldown#929 by introducing a `maxParallel` config option that limits how many workspace package builds can run concurrently. Without a limit, `buildWithConfigs` uses `Promise.all()` which starts all workspace builds simultaneously. When combined with `dts.tsgo: true`, each package spawns a `tsgo` subprocess, which can result in dozens of concurrent native processes and exhaust system resources. When `maxParallel` is set to a positive integer, at most that many builds run at the same time via a simple worker-pool implementation. When omitted, existing unbounded concurrent behavior is preserved. Changes: - Add `maxParallel?: number` to `UserConfig` and keep it optional in `ResolvedConfig` (added to `MarkPartial` keys) - Add `--max-parallel <number>` CLI flag; parse it as a number in the action handler so the string from argv is correctly coerced - Add `normalizeMaxParallel`, `resolveMaxParallel`, and `mapWithConcurrency` helpers in `src/build.ts` - Update `buildWithConfigs` to use the concurrency-limited pool when `maxParallel` is specified Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The per-option validation (positive integer check) belongs in options.ts alongside all other single-config validation, not in build.ts. build.ts still owns the cross-config resolveMaxParallel and the mapWithConcurrency utility since those operate on the already-resolved config array. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
maxParallel is a root-level option; workspace merging ensures all resolved configs have the same value. Reading configs[0].maxParallel is sufficient and simpler. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Superseded by rolldown#940.