test: fix test-worker-memory.js for large cpu #s · nodejs/node@f96a660 (original) (raw)

Original file line number Diff line number Diff line change
@@ -4,7 +4,13 @@ const assert = require('assert');
4 4 const util = require('util');
5 5 const { Worker } = require('worker_threads');
6 6
7 -const numWorkers = +process.env.JOBS |
7 +let numWorkers = +process.env.JOBS |
8 +if (numWorkers > 20) {
9 +// Cap the number of workers at 20 (as an even divisor of 60 used as
10 +// the total number of workers started) otherwise the test fails on
11 +// machines with high core counts.
12 +numWorkers = 20;
13 +}
8 14
9 15 // Verify that a Worker's memory isn't kept in memory after the thread finishes.
10 16