Skip to content

Commit 16f1c1e

Browse files
committed
fix(@angular/build): reduce the number of max workers 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 0a22e05)
1 parent 2d51e86 commit 16f1c1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/angular/build/src/utils/environment-options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const allowMinify = debugOptimize.minify;
7878
const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
7979
export const maxWorkers = isPresent(maxWorkersVariable)
8080
? +maxWorkersVariable
81-
: Math.min(4, availableParallelism());
81+
: Math.min(4, Math.max(availableParallelism() - 1, 1));
8282

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

0 commit comments

Comments
 (0)