public function QueueJobOperator::processQueues in Drush Queue Handling 8
Processes drush queues.
File
- src/
QueueJobOperator.php, line 73
Class
- QueueJobOperator
- Discovery and instantiation of default queue jobs.
Namespace
Drupal\mob_queueCode
public function processQueues($queue_name, $info) {
$this->queueFactory
->get($queue_name)
->createQueue();
$queue_worker = $this->queueManager
->createInstance($queue_name);
$end = time() + (isset($info['mob_queue']['time']) ? $info['mob_queue']['time'] : 15);
$queue = $this->queueFactory
->get($queue_name);
while (time() < $end && ($item = $queue
->claimItem())) {
try {
$queue_worker
->processItem($item->data);
$queue
->deleteItem($item);
} catch (RequeueException $e) {
// The worker requested the task be immediately requeued.
$queue
->releaseItem($item);
} catch (SuspendQueueException $e) {
// If the worker indicates there is a problem with the whole queue,
// release the item and skip to the next queue.
$queue
->releaseItem($item);
watchdog_exception('mob_queue', $e);
// Stop processing the current queue.
return;
} catch (\Exception $e) {
// In case of any other kind of exception, log it and leave the item
// in the queue to be processed again later.
watchdog_exception('mob_queue', $e);
}
}
}