Skip to content

Commit 511000e

Browse files
authored
cli: Use os.availableParallelism() instead of os.cpus().length (#46247)
Node has this function (and has since v18.14, apparently) that's specifically intended to give us the number we want. We should use it.
1 parent 09a0b40 commit 511000e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tools/cli/commands/phan.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export async function builder( yargs ) {
6767
.option( 'concurrency', {
6868
type: 'number',
6969
description: 'Maximum number of phan tasks to run at once.',
70-
default: os.cpus().length,
70+
default: os.availableParallelism(),
7171
coerce: coerceConcurrency,
7272
} )
7373
.option( 'format', {

tools/cli/commands/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function builder( yargs ) {
4848
.option( 'concurrency', {
4949
type: 'number',
5050
description: 'Maximum number of test tasks to run at once. Ignored with `--verbose`.',
51-
default: os.cpus().length,
51+
default: os.availableParallelism(),
5252
coerce: coerceConcurrency,
5353
} )
5454
.option( 'no-html', {

0 commit comments

Comments
 (0)