Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
move maxThreads outside of loop
Robert Brignull committed Aug 17, 2020

Unverified

No user is associated with the committer email.
1 parent aaeb975 commit 5eb3736
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/util.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/util.ts
@@ -385,12 +385,12 @@ export function getMemoryFlag(): string {
export function getThreadsFlag(): string {
let numThreads: number;
const numThreadsString = core.getInput("threads");
const maxThreads = os.cpus().length;
if (numThreadsString) {
numThreads = Number(numThreadsString);
if (Number.isNaN(numThreads)) {
throw new Error(`Invalid threads setting "${numThreadsString}", specified.`);
}
const maxThreads = os.cpus().length;
if (numThreads > maxThreads) {
core.info(`Clamping desired number of threads (${numThreads}) to max available (${maxThreads}).`);
numThreads = maxThreads;
@@ -402,7 +402,7 @@ export function getThreadsFlag(): string {
}
} else {
// Default to using all threads
numThreads = os.cpus().length;
numThreads = maxThreads;
}
return `--threads=${numThreads}`;
}

0 comments on commit 5eb3736

Please sign in to comment.