public function AcquiaPurgeCapacity::httpRequestsLimit in Acquia Purge 7
Get the number of HTTP requests that executors are allowed to make.
Return value
int The number of HTTP requests that executors are allowed to make.
1 call to AcquiaPurgeCapacity::httpRequestsLimit()
- AcquiaPurgeCapacity::queueClaimsLimit in lib/
AcquiaPurgeCapacity.php - Get the number of queue items that can be processed during runtime.
File
- lib/
AcquiaPurgeCapacity.php, line 142 - Contains AcquiaPurgeCapacity.
Class
- AcquiaPurgeCapacity
- Runtime capacity tracker.
Code
public function httpRequestsLimit() {
if (is_null($this->httpRequestsLimit)) {
// For Drush/CLI environments, adopt the overall HTTP requests limit.
$this->httpRequestsLimit = self::HTTP_REQUESTS_LIMIT;
// However, once PHP's max_execution_time isn't zero, we'll take 80% of
// the available seconds and divide that through the HTTP request timeout
// that a single HTTP request can maximally take. Because of the fact that
// AcquiaPurgeExecutorBase::requestsExecute() performs parallel HTTP
// request execution, we multiply by that.
$max_exec_time = (int) ini_get('max_execution_time');
if ($max_exec_time != 0) {
$max_exec_time = intval(ceil(0.8 * $max_exec_time));
$this->httpRequestsLimit = self::HTTP_PARALLEL_REQUESTS * ($max_exec_time / self::HTTP_REQUEST_TIMEOUT);
// When this value exceeds the total limit, take the limit instead.
if ($this->httpRequestsLimit > self::HTTP_REQUESTS_LIMIT) {
$this->httpRequestsLimit = self::HTTP_REQUESTS_LIMIT;
}
}
}
return $this->httpRequestsLimit;
}