diff --git a/doc/03-cli.md b/doc/03-cli.md index 8d9d3752c..deef3356c 100644 --- a/doc/03-cli.md +++ b/doc/03-cli.md @@ -1271,6 +1271,11 @@ defaults to 12 and must be between 1 and 50. If your proxy has issues with concurrency maybe you want to lower this. Increasing it should generally not result in performance gains. +### COMPOSER_MAX_PARALLEL_PROCESSES + +Set to an an integer to configure how many processes can be executed in parallel. +This defaults to 10 and must be between 1 and 50. + ### COMPOSER_IPRESOLVE Set to `4` or `6` to force IPv4 or IPv6 DNS resolution. This only works when the diff --git a/src/Composer/Util/ProcessExecutor.php b/src/Composer/Util/ProcessExecutor.php index dc773beb9..11db709ee 100644 --- a/src/Composer/Util/ProcessExecutor.php +++ b/src/Composer/Util/ProcessExecutor.php @@ -78,6 +78,7 @@ class ProcessExecutor public function __construct(?IOInterface $io = null) { $this->io = $io; + $this->resetMaxJobs(); } /** @@ -350,7 +351,11 @@ class ProcessExecutor public function resetMaxJobs(): void { - $this->maxJobs = 10; + if (is_numeric($maxJobs = Platform::getEnv('COMPOSER_MAX_PARALLEL_PROCESSES'))) { + $this->maxJobs = max(1, min(50, (int) $maxJobs)); + } else { + $this->maxJobs = 10; + } } /**