Skip to content

Commit

Permalink
fix(core): build-project-graph shouldn't fail when large number of wo…
Browse files Browse the repository at this point in the history
…rkers are available (#9804)

fixes #9801
  • Loading branch information
AgentEnder authored and FrozenPandaz committed Apr 19, 2022
1 parent 2b045e0 commit d37379f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/nx/src/project-graph/build-project-graph.ts
Expand Up @@ -49,7 +49,6 @@ export async function buildProjectGraph() {

const cacheEnabled = process.env.NX_CACHE_PROJECT_GRAPH !== 'false';
let cache = cacheEnabled ? readCache() : null;

return (
await buildProjectGraphUsingProjectFileMap(
workspaceJson,
Expand Down Expand Up @@ -292,7 +291,10 @@ function buildExplicitDependenciesUsingWorkers(
totalNumOfFilesToProcess: number,
builder: ProjectGraphBuilder
) {
const numberOfWorkers = getNumberOfWorkers();
const numberOfWorkers = Math.min(
totalNumOfFilesToProcess,
getNumberOfWorkers()
);
const bins = splitFilesIntoBins(
ctx,
totalNumOfFilesToProcess,
Expand Down

0 comments on commit d37379f

Please sign in to comment.