Skip to content

Commit 5eb3736

Browse files
move maxThreads outside of loop
1 parent aaeb975 commit 5eb3736

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/util.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,12 @@ export function getMemoryFlag(): string {
385385
export function getThreadsFlag(): string {
386386
let numThreads: number;
387387
const numThreadsString = core.getInput("threads");
388+
const maxThreads = os.cpus().length;
388389
if (numThreadsString) {
389390
numThreads = Number(numThreadsString);
390391
if (Number.isNaN(numThreads)) {
391392
throw new Error(`Invalid threads setting "${numThreadsString}", specified.`);
392393
}
393-
const maxThreads = os.cpus().length;
394394
if (numThreads > maxThreads) {
395395
core.info(`Clamping desired number of threads (${numThreads}) to max available (${maxThreads}).`);
396396
numThreads = maxThreads;
@@ -402,7 +402,7 @@ export function getThreadsFlag(): string {
402402
}
403403
} else {
404404
// Default to using all threads
405-
numThreads = os.cpus().length;
405+
numThreads = maxThreads;
406406
}
407407
return `--threads=${numThreads}`;
408408
}

0 commit comments

Comments
 (0)