Skip to content

Commit 7af2c57

Browse files
authored
Simplify getThreads() (#186)
1 parent 6b6c3f1 commit 7af2c57

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

lib/getThreads.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22

33
const os = require('os');
44

5-
// eslint-disable-next-line unicorn/explicit-length-check
6-
const CPUS = os.cpus() && os.cpus().length;
7-
const THREADS = CPUS > 2 ? CPUS - 1 : 1;
8-
9-
function getThreads(config) {
10-
const { threads } = config;
5+
const THREADS = Math.max(os.cpus().length - 1, 1);
116

7+
function getThreads({ threads }) {
128
switch (threads) {
139
case 'auto':
1410
case -1:

0 commit comments

Comments
 (0)