Skip to content

Commit 257224d

Browse files
deokjinkimjuanarbol
authored andcommitted
test: use os.availableParallelism()
Refs: #45895 PR-URL: #46003 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent ec34cad commit 257224d

14 files changed

+14
-14
lines changed

test/parallel/test-cluster-concurrent-disconnect.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const os = require('os');
1010

1111
if (cluster.isPrimary) {
1212
const workers = [];
13-
const numCPUs = os.cpus().length;
13+
const numCPUs = os.availableParallelism();
1414
let waitOnline = numCPUs;
1515
for (let i = 0; i < numCPUs; i++) {
1616
const worker = cluster.fork();

test/parallel/test-gc-http-client-connaborted.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const onGC = require('../common/ongc');
88
const http = require('http');
99
const os = require('os');
1010

11-
const cpus = os.cpus().length;
11+
const cpus = os.availableParallelism();
1212
let createClients = true;
1313
let done = 0;
1414
let count = 0;

test/parallel/test-gc-net-timeout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function serverHandler(sock) {
2626
}, 100);
2727
}
2828

29-
const cpus = os.cpus().length;
29+
const cpus = os.availableParallelism();
3030
let createClients = true;
3131
let done = 0;
3232
let count = 0;

test/parallel/test-worker-memory.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const assert = require('assert');
77
const util = require('util');
88
const { Worker } = require('worker_threads');
99

10-
let numWorkers = +process.env.JOBS || require('os').cpus().length;
10+
let numWorkers = +process.env.JOBS || require('os').availableParallelism();
1111
if (numWorkers > 20) {
1212
// Cap the number of workers at 20 (as an even divisor of 60 used as
1313
// the total number of workers started) otherwise the test fails on

test/pummel/test-policy-integrity-dep.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const fs = require('fs');
2222
const path = require('path');
2323
const { pathToFileURL } = require('url');
2424

25-
const cpus = require('os').cpus().length;
25+
const cpus = require('os').availableParallelism();
2626

2727
function hash(algo, body) {
2828
const values = [];

test/pummel/test-policy-integrity-parent-commonjs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const fs = require('fs');
2222
const path = require('path');
2323
const { pathToFileURL } = require('url');
2424

25-
const cpus = require('os').cpus().length;
25+
const cpus = require('os').availableParallelism();
2626

2727
function hash(algo, body) {
2828
const values = [];

test/pummel/test-policy-integrity-parent-module.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const fs = require('fs');
2222
const path = require('path');
2323
const { pathToFileURL } = require('url');
2424

25-
const cpus = require('os').cpus().length;
25+
const cpus = require('os').availableParallelism();
2626

2727
function hash(algo, body) {
2828
const values = [];

test/pummel/test-policy-integrity-parent-no-package-json.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const fs = require('fs');
2222
const path = require('path');
2323
const { pathToFileURL } = require('url');
2424

25-
const cpus = require('os').cpus().length;
25+
const cpus = require('os').availableParallelism();
2626

2727
function hash(algo, body) {
2828
const values = [];

test/pummel/test-policy-integrity-worker-commonjs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const fs = require('fs');
2222
const path = require('path');
2323
const { pathToFileURL } = require('url');
2424

25-
const cpus = require('os').cpus().length;
25+
const cpus = require('os').availableParallelism();
2626

2727
function hash(algo, body) {
2828
const values = [];

test/pummel/test-policy-integrity-worker-module.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const fs = require('fs');
2222
const path = require('path');
2323
const { pathToFileURL } = require('url');
2424

25-
const cpus = require('os').cpus().length;
25+
const cpus = require('os').availableParallelism();
2626

2727
function hash(algo, body) {
2828
const values = [];

test/pummel/test-policy-integrity-worker-no-package-json.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const fs = require('fs');
2222
const path = require('path');
2323
const { pathToFileURL } = require('url');
2424

25-
const cpus = require('os').cpus().length;
25+
const cpus = require('os').availableParallelism();
2626

2727
function hash(algo, body) {
2828
const values = [];

test/sequential/test-gc-http-client-onerror.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const common = require('../common');
77
const onGC = require('../common/ongc');
88

9-
const cpus = require('os').cpus().length;
9+
const cpus = require('os').availableParallelism();
1010

1111
function serverHandler(req, res) {
1212
req.resume();

test/sequential/test-gc-http-client-timeout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function serverHandler(req, res) {
1616
}, 100);
1717
}
1818

19-
const cpus = os.cpus().length;
19+
const cpus = os.availableParallelism();
2020
const numRequests = 36;
2121
let createClients = true;
2222
let done = 0;

test/sequential/test-gc-http-client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const common = require('../common');
66
const onGC = require('../common/ongc');
77

8-
const cpus = require('os').cpus().length;
8+
const cpus = require('os').availableParallelism();
99

1010
function serverHandler(req, res) {
1111
res.writeHead(200, { 'Content-Type': 'text/plain' });

0 commit comments

Comments
 (0)