Skip to content

Commit

Permalink
test: use os.availableParallelism()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
deokjinkim authored and juanarbol committed Jan 31, 2023
1 parent ec34cad commit 257224d
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-concurrent-disconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const os = require('os');

if (cluster.isPrimary) {
const workers = [];
const numCPUs = os.cpus().length;
const numCPUs = os.availableParallelism();
let waitOnline = numCPUs;
for (let i = 0; i < numCPUs; i++) {
const worker = cluster.fork();
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-gc-http-client-connaborted.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const onGC = require('../common/ongc');
const http = require('http');
const os = require('os');

const cpus = os.cpus().length;
const cpus = os.availableParallelism();
let createClients = true;
let done = 0;
let count = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-gc-net-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function serverHandler(sock) {
}, 100);
}

const cpus = os.cpus().length;
const cpus = os.availableParallelism();
let createClients = true;
let done = 0;
let count = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-worker-memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const assert = require('assert');
const util = require('util');
const { Worker } = require('worker_threads');

let numWorkers = +process.env.JOBS || require('os').cpus().length;
let numWorkers = +process.env.JOBS || require('os').availableParallelism();
if (numWorkers > 20) {
// Cap the number of workers at 20 (as an even divisor of 60 used as
// the total number of workers started) otherwise the test fails on
Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-policy-integrity-dep.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const fs = require('fs');
const path = require('path');
const { pathToFileURL } = require('url');

const cpus = require('os').cpus().length;
const cpus = require('os').availableParallelism();

function hash(algo, body) {
const values = [];
Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-policy-integrity-parent-commonjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const fs = require('fs');
const path = require('path');
const { pathToFileURL } = require('url');

const cpus = require('os').cpus().length;
const cpus = require('os').availableParallelism();

function hash(algo, body) {
const values = [];
Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-policy-integrity-parent-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const fs = require('fs');
const path = require('path');
const { pathToFileURL } = require('url');

const cpus = require('os').cpus().length;
const cpus = require('os').availableParallelism();

function hash(algo, body) {
const values = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const fs = require('fs');
const path = require('path');
const { pathToFileURL } = require('url');

const cpus = require('os').cpus().length;
const cpus = require('os').availableParallelism();

function hash(algo, body) {
const values = [];
Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-policy-integrity-worker-commonjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const fs = require('fs');
const path = require('path');
const { pathToFileURL } = require('url');

const cpus = require('os').cpus().length;
const cpus = require('os').availableParallelism();

function hash(algo, body) {
const values = [];
Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-policy-integrity-worker-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const fs = require('fs');
const path = require('path');
const { pathToFileURL } = require('url');

const cpus = require('os').cpus().length;
const cpus = require('os').availableParallelism();

function hash(algo, body) {
const values = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const fs = require('fs');
const path = require('path');
const { pathToFileURL } = require('url');

const cpus = require('os').cpus().length;
const cpus = require('os').availableParallelism();

function hash(algo, body) {
const values = [];
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-gc-http-client-onerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const common = require('../common');
const onGC = require('../common/ongc');

const cpus = require('os').cpus().length;
const cpus = require('os').availableParallelism();

function serverHandler(req, res) {
req.resume();
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-gc-http-client-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function serverHandler(req, res) {
}, 100);
}

const cpus = os.cpus().length;
const cpus = os.availableParallelism();
const numRequests = 36;
let createClients = true;
let done = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-gc-http-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const common = require('../common');
const onGC = require('../common/ongc');

const cpus = require('os').cpus().length;
const cpus = require('os').availableParallelism();

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

0 comments on commit 257224d

Please sign in to comment.