From f9f968499a610b88a1a4ee0b83c4ae2710834248 Mon Sep 17 00:00:00 2001 From: Yuxuan Zhang Date: Fri, 29 Dec 2023 02:53:23 -0500 Subject: [PATCH] config: use local machine's cpu count for default concurrency value --- src/node/config.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/node/config.ts b/src/node/config.ts index ee0e2e94..9fcf4625 100644 --- a/src/node/config.ts +++ b/src/node/config.ts @@ -19,6 +19,7 @@ import { type SiteData } from './shared' import type { RawConfigExports, SiteConfig, UserConfig } from './siteConfig' +import { cpus } from 'os' export { resolvePages } from './plugins/dynamicRoutesPlugin' export * from './siteConfig' @@ -142,7 +143,11 @@ export async function resolveConfig( rewrites, userConfig, sitemap: userConfig.sitemap, - buildConcurrency: userConfig.buildConcurrency ?? 64 + buildConcurrency: Math.max( + userConfig.buildConcurrency ?? cpus().length, + 1 // At least one thread required + ), + multithreadRender: userConfig.multithreadRender ?? false } // to be shared with content loaders