public function AdvancedQueueCommands::process in Advanced Queue 8
Process a queue.
@command advancedqueue:queue:process
Parameters
string $queue_id: The queue ID.
Throws
\Exception
File
- src/
Commands/ AdvancedQueueCommands.php, line 56
Class
- AdvancedQueueCommands
- Declares AdvancedQueue module Drush commands.
Namespace
Drupal\advancedqueue\CommandsCode
public function process($queue_id) {
$queue_storage = $this->entityTypeManager
->getStorage('advancedqueue_queue');
/** @var \Drupal\advancedqueue\Entity\QueueInterface $queue */
$queue = $queue_storage
->load($queue_id);
if (!$queue) {
throw new \Exception(dt('Could not find queue "@queue_id".', [
'@queue_id' => $queue_id,
]));
}
$start = microtime(TRUE);
$num_processed = $this->processor
->processQueue($queue);
$elapsed = microtime(TRUE) - $start;
$this
->io()
->success(dt('Processed @count jobs from the @queue queue in @elapsed seconds.', [
'@count' => $num_processed,
'@queue' => $queue
->label(),
'@elapsed' => round($elapsed, 2),
]));
}