Skip to content
Merged
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
8 changes: 1 addition & 7 deletions src/shared/processConcurrency.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import os from 'node:os';

export const getProcessConcurrency = () => {
const cpuCount = os.cpus().length;

// Fallback for environments where os.cpus().length returns 0
// see: https://github.com/yamadashy/repopack/issues/56
if (cpuCount === 0) {
return 1;
}
const cpuCount = typeof os.availableParallelism === 'function' ? os.availableParallelism() : os.cpus().length;

// Use all available CPUs except one
return Math.max(1, cpuCount - 1);
Expand Down