diff --git a/packages/cli/src/lib/parallel.ts b/packages/cli/src/lib/parallel.ts index 246020fcc3..15946bd70d 100644 --- a/packages/cli/src/lib/parallel.ts +++ b/packages/cli/src/lib/parallel.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +import os from 'os'; import { ErrorLike } from '@backstage/errors'; import { Worker } from 'worker_threads'; @@ -137,7 +138,7 @@ export type WorkerQueueThreadsOptions = { workerFactory: (data: TData) => (item: TItem) => Promise; /** Data supplied to each worker factory */ workerData?: TData; - /** Number of threads, defaults to the environment parallelism */ + /** Number of threads, defaults to half of the number of available CPUs */ threadCount?: number; }; @@ -151,7 +152,7 @@ export async function runWorkerQueueThreads( const { workerFactory, workerData, - threadCount = getEnvironmentParallelism(), + threadCount = os.cpus().length / 2, } = options; const iterator = options.items[Symbol.iterator]();