Skip to content

Commit

Permalink
feat: Default to number of processors for exec concurrency (#654)
Browse files Browse the repository at this point in the history
* better default value for exec concurrency

* reformat file

* change default value inside function
  • Loading branch information
MohiuddinM authored Mar 10, 2024
1 parent 95f2371 commit 43c6ddb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/melos/lib/src/command_runner/exec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ import 'base.dart';
class ExecCommand extends MelosCommand {
ExecCommand(super.config) {
setupPackageFilterParser();
argParser.addOption('concurrency', defaultsTo: '5', abbr: 'c');
argParser.addOption(
'concurrency',
defaultsTo: Platform.numberOfProcessors.toString(),
abbr: 'c',
);
argParser.addFlag(
'fail-fast',
abbr: 'f',
Expand Down
3 changes: 2 additions & 1 deletion packages/melos/lib/src/commands/exec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ mixin _ExecMixin on _Melos {
List<String> execArgs, {
GlobalOptions? global,
PackageFilters? packageFilters,
int concurrency = 5,
int? concurrency,
bool failFast = false,
bool orderDependents = false,
}) async {
concurrency ??= Platform.numberOfProcessors;
final workspace =
await createWorkspace(global: global, packageFilters: packageFilters);
final packages = workspace.filteredPackages.values;
Expand Down

0 comments on commit 43c6ddb

Please sign in to comment.