You are here

public function AcquiaCloudPurger::getIdealConditionsLimit in Acquia Purge 8

Get the maximum number of invalidations that this purger can process.

When Drupal requests are served through a webserver, several resource limitations - such as maximum execution time - affect how much objects are given to your purger plugin. However, under certain conditions - such as when ran through the command line - these limitations aren't in place. This is the 'ideal conditions' scenario under which your purger can operate.

However, we cannot feed the entire queue at once and therefore there will always be a hard outer limit of how many invalidation objects are being processed during Drupal's request lifetime.

Return value

int The number of invalidations you can process under ideal conditions.

Overrides PurgerBase::getIdealConditionsLimit

See also

\Drupal\purge\Plugin\Purge\Purger\CapacityTrackerInterface::getRemainingInvalidationsLimit()

File

src/Plugin/Purge/Purger/AcquiaCloudPurger.php, line 176

Class

AcquiaCloudPurger
Acquia Cloud.

Namespace

Drupal\acquia_purge\Plugin\Purge\Purger

Code

public function getIdealConditionsLimit() {

  // The max amount of outgoing HTTP requests that can be made during script
  // execution time. Although always respected as outer limit, it will be
  // lower in practice as PHP resource limits (max execution time) bring it
  // further down. However, the maximum amount of requests will be higher on
  // the CLI.
  $balancers = count($this->platformInfo
    ->getBalancerAddresses());
  if ($balancers) {
    return intval(ceil(200 / $balancers));
  }
  return 100;
}