1
0
Fork 0

Allow tweaking the max parallel http requests via env var, fixes #9671

pull/9702/head
Jordi Boggiano 2021-02-10 14:34:59 +01:00
parent a6d92e1eee
commit 40095b20dc
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 12 additions and 1 deletions

View File

@ -1014,6 +1014,13 @@ similar use case), and need to support proxies, please provide the `CGI_HTTP_PRO
environment variable instead. See [httpoxy.org](https://httpoxy.org/) for further environment variable instead. See [httpoxy.org](https://httpoxy.org/) for further
details. details.
### COMPOSER_MAX_PARALLEL_HTTP
Set to an integer to configure how many files can be downloaded in parallel. This
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.
### HTTP_PROXY_REQUEST_FULLURI ### HTTP_PROXY_REQUEST_FULLURI
If you use a proxy, but it does not support the request_fulluri flag, then you If you use a proxy, but it does not support the request_fulluri flag, then you

View File

@ -37,7 +37,7 @@ class HttpDownloader
private $jobs = array(); private $jobs = array();
private $options = array(); private $options = array();
private $runningJobs = 0; private $runningJobs = 0;
private $maxJobs = 10; private $maxJobs = 12;
private $curl; private $curl;
private $rfs; private $rfs;
private $idGen = 0; private $idGen = 0;
@ -71,6 +71,10 @@ class HttpDownloader
} }
$this->rfs = new RemoteFilesystem($io, $config, $options, $disableTls); $this->rfs = new RemoteFilesystem($io, $config, $options, $disableTls);
if (is_numeric($maxJobs = getenv('COMPOSER_MAX_PARALLEL_HTTP'))) {
$this->maxJobs = max(1, min(50, (int) $maxJobs));
}
} }
/** /**