diff --git a/packages/docusaurus-plugin-content-docs/src/index.ts b/packages/docusaurus-plugin-content-docs/src/index.ts index c45c520ac5d0..3c304c2c9c2b 100644 --- a/packages/docusaurus-plugin-content-docs/src/index.ts +++ b/packages/docusaurus-plugin-content-docs/src/index.ts @@ -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 @@ -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(