mirror of
https://github.com/pnpm/pnpm.git
synced 2026-02-15 17:42:31 -05:00
feat: allow to specify the max amount of workers used by pnpm (#10056)
This commit is contained in:
6
.changeset/little-berries-remain.md
Normal file
6
.changeset/little-berries-remain.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/worker": minor
|
||||
"pnpm": minor
|
||||
---
|
||||
|
||||
Allow to specify the max amount of pnpm workers via the PNPM_MAX_WORKERS environment variable.
|
||||
@@ -53,6 +53,9 @@ function createTarballWorkerPool (): WorkerPool {
|
||||
}
|
||||
|
||||
function calcMaxWorkers () {
|
||||
if (process.env.PNPM_MAX_WORKERS) {
|
||||
return parseInt(process.env.PNPM_MAX_WORKERS)
|
||||
}
|
||||
if (process.env.PNPM_WORKERS) {
|
||||
const idleCPUs = Math.abs(parseInt(process.env.PNPM_WORKERS))
|
||||
return Math.max(2, availableParallelism() - idleCPUs) - 1
|
||||
|
||||
Reference in New Issue
Block a user