You are here

public function CapacityTracker::waitCooldownTime in Purge 8.3

Wait the time in seconds for the given purger.

Parameters

string $purger_instance_id: The instance ID of the purger for which to await the cooldown time.

Throws

\Drupal\purge\Plugin\Purge\Purger\Exception\BadBehaviorException Thrown when $purger_instance_id doesn't exist.

Overrides CapacityTrackerInterface::waitCooldownTime

See also

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

\Drupal\purge\Plugin\Purge\Purger\PurgersServiceInterface::invalidate()

File

src/Plugin/Purge/Purger/CapacityTracker.php, line 379

Class

CapacityTracker
Provides the capacity tracker.

Namespace

Drupal\purge\Plugin\Purge\Purger

Code

public function waitCooldownTime($purger_instance_id) {
  $seconds = $this
    ->getCooldownTime($purger_instance_id);
  if (!($seconds == 0)) {
    $fractions = explode('.', (string) $seconds);
    if (isset($fractions[1])) {
      call_user_func_array('time_nanosleep', $fractions);
    }
    else {
      sleep($seconds);
    }
  }
}