Skip to content

Commit d37379f

Browse files
AgentEnderFrozenPandaz
authored andcommitted
fix(core): build-project-graph shouldn't fail when large number of workers are available (#9804)
fixes #9801
1 parent 2b045e0 commit d37379f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/nx/src/project-graph/build-project-graph.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export async function buildProjectGraph() {
4949

5050
const cacheEnabled = process.env.NX_CACHE_PROJECT_GRAPH !== 'false';
5151
let cache = cacheEnabled ? readCache() : null;
52-
5352
return (
5453
await buildProjectGraphUsingProjectFileMap(
5554
workspaceJson,
@@ -292,7 +291,10 @@ function buildExplicitDependenciesUsingWorkers(
292291
totalNumOfFilesToProcess: number,
293292
builder: ProjectGraphBuilder
294293
) {
295-
const numberOfWorkers = getNumberOfWorkers();
294+
const numberOfWorkers = Math.min(
295+
totalNumOfFilesToProcess,
296+
getNumberOfWorkers()
297+
);
296298
const bins = splitFilesIntoBins(
297299
ctx,
298300
totalNumOfFilesToProcess,

0 commit comments

Comments
 (0)