Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): reduce the number of max workers …
Browse files Browse the repository at this point in the history
…to available CPUs minus one

This commit reduces the maximum number of workers to the available CPUs minus 1. This adjustment ensures that some resources are left for the main thread, preventing it from being starved of CPU cycles.

(cherry picked from commit 164c0d8)
  • Loading branch information
alan-agius4 committed Jul 1, 2024
1 parent 16f1c1e commit 9b43ecb
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const allowMinify = debugOptimize.minify;
const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
export const maxWorkers = isPresent(maxWorkersVariable)
? +maxWorkersVariable
: Math.min(4, availableParallelism());
: Math.min(4, Math.max(availableParallelism() - 1, 1));

const parallelTsVariable = process.env['NG_BUILD_PARALLEL_TS'];
export const useParallelTs = !isPresent(parallelTsVariable) || !isDisabled(parallelTsVariable);
Expand Down

0 comments on commit 9b43ecb

Please sign in to comment.