protected function SocialDrupalContext::processQueue in Open Social 10.2.x
Same name and namespace in other branches
- 8.9 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::processQueue()
- 8.3 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::processQueue()
- 8.4 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::processQueue()
- 8.5 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::processQueue()
- 8.6 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::processQueue()
- 8.7 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::processQueue()
- 8.8 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::processQueue()
- 10.3.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::processQueue()
- 10.0.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::processQueue()
- 10.1.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::processQueue()
Process queue items.
Parameters
bool $just_delete: If set to TRUE, it doesn't process the items, but simply deletes them.
2 calls to SocialDrupalContext::processQueue()
- SocialDrupalContext::iEmptyTheQueue in tests/
behat/ features/ bootstrap/ SocialDrupalContext.php - @When I empty the queue
- SocialDrupalContext::iWaitForTheQueueToBeEmpty in tests/
behat/ features/ bootstrap/ SocialDrupalContext.php - @When I wait for the queue to be empty
File
- tests/
behat/ features/ bootstrap/ SocialDrupalContext.php, line 274
Class
- SocialDrupalContext
- Provides pre-built step definitions for interacting with Open Social.
Namespace
Drupal\social\BehatCode
protected function processQueue($just_delete = FALSE) {
$workerManager = \Drupal::service('plugin.manager.queue_worker');
/** @var Drupal\Core\Queue\QueueFactory; $queue */
$queue = \Drupal::service('queue');
for ($i = 0; $i < 20; $i++) {
foreach ($workerManager
->getDefinitions() as $name => $info) {
/** @var Drupal\Core\Queue\QueueInterface $worker */
$worker = $queue
->get($name);
/** @var \Drupal\Core\Queue\QueueWorkerInterface $queue_worker */
$queue_worker = $workerManager
->createInstance($name);
if ($worker
->numberOfItems() > 0) {
while ($item = $worker
->claimItem()) {
// If we don't just delete them, process the item first.
if ($just_delete === FALSE) {
$queue_worker
->processItem($item->data);
}
$worker
->deleteItem($item);
}
}
}
}
if (\Drupal::moduleHandler()
->moduleExists('advancedqueue')) {
$queue_storage = \Drupal::service("entity_type.manager")
->getStorage('advancedqueue_queue');
/** @var \Drupal\advancedqueue\Entity\QueueInterface $queue */
$queue = $queue_storage
->load('default');
/** @var \Drupal\advancedqueue\Processor $processor */
$processor = \Drupal::service('advancedqueue.processor');
$processor
->processQueue($queue);
}
}