Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: use os.availableParallelism()
Refs: #45895
  • Loading branch information
deokjinkim committed Jan 11, 2023
commit 2747363dc7670a0997e028165589d68f880e5592
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