mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
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: https://github.com/nodejs/node/pull/45969 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
0a70316ecc
commit
7ae24abd7b
1 file changed
+3
-3
@@ -53,7 +53,7 @@ const {
|
||||
} = require('internal/validators');
|
||||
const { setTimeout } = require('timers/promises');
|
||||
const { TIMEOUT_MAX } = require('internal/timers');
|
||||
const { cpus } = require('os');
|
||||
const { availableParallelism } = require('os');
|
||||
const { bigint: hrtime } = process.hrtime;
|
||||
const kCallbackAndPromisePresent = 'callbackAndPromisePresent';
|
||||
const kCancelledByParent = 'cancelledByParent';
|
||||
@@ -217,8 +217,8 @@ class Test extends AsyncResource {
|
||||
|
||||
case 'boolean':
|
||||
if (concurrency) {
|
||||
// TODO(cjihrig): Use uv_available_parallelism() once it lands.
|
||||
this.concurrency = parent === null ? MathMax(cpus().length - 1, 1) : Infinity;
|
||||
this.concurrency = parent === null ?
|
||||
MathMax(availableParallelism() - 1, 1) : Infinity;
|
||||
} else {
|
||||
this.concurrency = 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user