fix(core): build-project-graph shouldn't fail when large number of workers are available (#9804)

fixes #9801
This commit is contained in:
Craigory Coppola 2022-04-14 17:08:47 -04:00 committed by GitHub
parent 4b846e8dc9
commit 1857138e74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,6 @@ export async function buildProjectGraph() {
const cacheEnabled = process.env.NX_CACHE_PROJECT_GRAPH !== 'false'; const cacheEnabled = process.env.NX_CACHE_PROJECT_GRAPH !== 'false';
let cache = cacheEnabled ? readCache() : null; let cache = cacheEnabled ? readCache() : null;
return ( return (
await buildProjectGraphUsingProjectFileMap( await buildProjectGraphUsingProjectFileMap(
workspaceJson, workspaceJson,
@ -292,7 +291,10 @@ function buildExplicitDependenciesUsingWorkers(
totalNumOfFilesToProcess: number, totalNumOfFilesToProcess: number,
builder: ProjectGraphBuilder builder: ProjectGraphBuilder
) { ) {
const numberOfWorkers = getNumberOfWorkers(); const numberOfWorkers = Math.min(
totalNumOfFilesToProcess,
getNumberOfWorkers()
);
const bins = splitFilesIntoBins( const bins = splitFilesIntoBins(
ctx, ctx,
totalNumOfFilesToProcess, totalNumOfFilesToProcess,