From ab8197ccdf305efe5cef37a180a64ecfee47de2b Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Fri, 13 Jan 2023 18:50:37 -0500 Subject: [PATCH] fix(core): cap inferred max workers count at 8 (#14366) --- packages/nx/src/project-graph/build-project-graph.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nx/src/project-graph/build-project-graph.ts b/packages/nx/src/project-graph/build-project-graph.ts index 2e67d3977a70c..31296c88dd32d 100644 --- a/packages/nx/src/project-graph/build-project-graph.ts +++ b/packages/nx/src/project-graph/build-project-graph.ts @@ -400,7 +400,7 @@ function buildExplicitDependenciesUsingWorkers( function getNumberOfWorkers(): number { return process.env.NX_PROJECT_GRAPH_MAX_WORKERS ? +process.env.NX_PROJECT_GRAPH_MAX_WORKERS - : os.cpus().length - 1; + : Math.min(os.cpus().length - 1, 8); // This is capped for cases in CI where `os.cpus()` returns way more CPUs than the resources that are allocated } function createContext(