Skip to content

Commit 7ae24ab

Browse files
cjihrigRafaelGSS
authored andcommitted
test_runner: use os.availableParallelism()
This commit addresses an existing TODO in the code by moving to the new os.availableParallelism() instead of os.cpus().length. PR-URL: #45969 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 0a70316 commit 7ae24ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/internal/test_runner/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const {
5353
} = require('internal/validators');
5454
const { setTimeout } = require('timers/promises');
5555
const { TIMEOUT_MAX } = require('internal/timers');
56-
const { cpus } = require('os');
56+
const { availableParallelism } = require('os');
5757
const { bigint: hrtime } = process.hrtime;
5858
const kCallbackAndPromisePresent = 'callbackAndPromisePresent';
5959
const kCancelledByParent = 'cancelledByParent';
@@ -217,8 +217,8 @@ class Test extends AsyncResource {
217217

218218
case 'boolean':
219219
if (concurrency) {
220-
// TODO(cjihrig): Use uv_available_parallelism() once it lands.
221-
this.concurrency = parent === null ? MathMax(cpus().length - 1, 1) : Infinity;
220+
this.concurrency = parent === null ?
221+
MathMax(availableParallelism() - 1, 1) : Infinity;
222222
} else {
223223
this.concurrency = 1;
224224
}

0 commit comments

Comments
 (0)