Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reduce number of concurrent git processes spawned #10349

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/docusaurus-plugin-content-docs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ import type {LoadContext, Plugin} from '@docusaurus/types';
import type {DocFile, FullVersion} from './types';
import type {RuleSetUseItem} from 'webpack';

// Reduces number of concurrent Git processes spawned to get file commit date
// See https://github.com/facebook/docusaurus/issues/10348
const Concurrency = process.env.DOCUSAURUS_GIT_CONCURRENCY
? parseInt(process.env.DOCUSAURUS_GIT_CONCURRENCY, 10)
: 100;

// TODO this is bad, we should have a better way to do this (new lifecycle?)
// The source to permalink is currently a mutable map passed to the mdx loader
// for link resolution
Expand Down Expand Up @@ -191,7 +197,15 @@ export default async function pluginContentDocs(
tagsFile,
});
}
return Promise.all(docFiles.map(processVersionDoc));
const results = [];
while (docFiles.length > 0) {
results.push(
...(await Promise.all(
docFiles.splice(0, Concurrency).map(processVersionDoc),
)),
);
}
return results;
}

async function doLoadVersion(
Expand Down