function Cron::processQueue

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Cron.php \Drupal\Core\Cron::processQueue()
  2. 10 core/lib/Drupal/Core/Cron.php \Drupal\Core\Cron::processQueue()

Processes a cron queue.

Parameters

\Drupal\Core\Queue\QueueInterface $queue: The queue.

\Drupal\Core\Queue\QueueWorkerInterface $worker: The queue worker.

Throws

\Drupal\Core\Queue\SuspendQueueException If the queue was suspended.

1 call to Cron::processQueue()
Cron::processQueues in core/lib/Drupal/Core/Cron.php
Processes cron queues.

File

core/lib/Drupal/Core/Cron.php, line 202

Class

Cron
The Drupal core Cron service.

Namespace

Drupal\Core

Code

protected function processQueue(QueueInterface $queue, QueueWorkerInterface $worker) {
  $lease_time = $worker->getPluginDefinition()['cron']['time'];
  $end = $this->time
    ->getCurrentTime() + $lease_time;
  while ($this->time
    ->getCurrentTime() < $end) {
    $claimed = $this->processItem($queue, $worker);
    if (!$claimed) {
      break;

    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.