diff --git a/core/core.services.yml b/core/core.services.yml index d04bcc6..ce35658 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -150,7 +150,7 @@ services: arguments: ['@typed_data_manager'] cron: class: Drupal\Core\Cron - arguments: ['@module_handler', '@lock', '@queue', '@state', '@current_user', '@session_manager', '@logger.channel.cron', '@plugin.manager.queue'] + arguments: ['@module_handler', '@lock', '@queue', '@state', '@current_user', '@session_manager', '@logger.channel.cron', '@plugin.manager.queue_worker'] diff.formatter: class: Drupal\Core\Diff\DiffFormatter arguments: ['@config.factory'] @@ -346,8 +346,8 @@ services: plugin.manager.display_variant: class: Drupal\Core\Display\VariantManager parent: default_plugin_manager - plugin.manager.queue: - class: Drupal\Core\Queue\QueuePluginManager + plugin.manager.queue_worker: + class: Drupal\Core\Queue\QueueWorkerManager parent: default_plugin_manager plugin.cache_clearer: class: Drupal\Core\Plugin\CachedDiscoveryClearer diff --git a/core/lib/Drupal/Core/Annotation/QueuePlugin.php b/core/lib/Drupal/Core/Annotation/QueueWorker.php similarity index 83% rename from core/lib/Drupal/Core/Annotation/QueuePlugin.php rename to core/lib/Drupal/Core/Annotation/QueueWorker.php index 5366b51..8b5df53 100644 --- a/core/lib/Drupal/Core/Annotation/QueuePlugin.php +++ b/core/lib/Drupal/Core/Annotation/QueueWorker.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\Core\Annotation\QueuePlugin. + * Contains \Drupal\Core\Annotation\QueueWorker. */ namespace Drupal\Core\Annotation; @@ -10,7 +10,7 @@ use Drupal\Component\Annotation\Plugin; /** - * Declare queues holding items that need to be run periodically. + * Declare queue workers that need to be run periodically. * * While there can be only one hook_cron() process running at the same time, * there can be any number of processes defined here running. Because of @@ -25,12 +25,12 @@ * * @see hook_cron() * @see hook_queue_info_alter() - * @see \Drupal\Core\Queue\QueuePluginInterface - * @see \Drupal\Core\Queue\QueuePluginManagerInterface + * @see \Drupal\Core\Queue\QueueWorkerInterface + * @see \Drupal\Core\Queue\QueueWorkerManagerInterface * * @Annotation */ -class QueuePlugin extends Plugin { +class QueueWorker extends Plugin { /** * The plugin ID. diff --git a/core/lib/Drupal/Core/Cron.php b/core/lib/Drupal/Core/Cron.php index 8bfe378..6b25b1d 100644 --- a/core/lib/Drupal/Core/Cron.php +++ b/core/lib/Drupal/Core/Cron.php @@ -8,7 +8,7 @@ namespace Drupal\Core; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Queue\QueuePluginManagerInterface; +use Drupal\Core\Queue\QueueWorkerManagerInterface; use Drupal\Core\State\StateInterface; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\Queue\QueueFactory; @@ -75,7 +75,7 @@ class Cron implements CronInterface { /** * The queue plugin manager. * - * @var \Drupal\Core\Queue\QueuePluginManagerInterface + * @var \Drupal\Core\Queue\QueueWorkerManagerInterface */ protected $queueManager; @@ -96,10 +96,10 @@ class Cron implements CronInterface { * The session manager. * @param \Psr\Log\LoggerInterface $logger * A logger instance. - * @param \Drupal\Core\Queue\QueuePluginManagerInterface + * @param \Drupal\Core\Queue\QueueWorkerManagerInterface * The queue plugin manager. */ - public function __construct(ModuleHandlerInterface $module_handler, LockBackendInterface $lock, QueueFactory $queue_factory, StateInterface $state, AccountProxyInterface $current_user, SessionManagerInterface $session_manager, LoggerInterface $logger, QueuePluginManagerInterface $queue_manager) { + public function __construct(ModuleHandlerInterface $module_handler, LockBackendInterface $lock, QueueFactory $queue_factory, StateInterface $state, AccountProxyInterface $current_user, SessionManagerInterface $session_manager, LoggerInterface $logger, QueueWorkerManagerInterface $queue_manager) { $this->moduleHandler = $module_handler; $this->lock = $lock; $this->queueFactory = $queue_factory; @@ -179,12 +179,12 @@ protected function processQueues() { // an existing queue. $this->queueFactory->get($queue_name)->createQueue(); - $queue_item = $this->queueManager->createInstance($queue_name); + $queue_worker = $this->queueManager->createInstance($queue_name); $end = time() + (isset($info['cron']['time']) ? $info['cron']['time'] : 15); $queue = $this->queueFactory->get($queue_name); while (time() < $end && ($item = $queue->claimItem())) { try { - $queue_item->processItem($item->data); + $queue_worker->processItem($item->data); $queue->deleteItem($item); } catch (SuspendQueueException $e) { diff --git a/core/lib/Drupal/Core/Queue/QueuePluginBase.php b/core/lib/Drupal/Core/Queue/QueuePluginBase.php deleted file mode 100644 index 87fa4cd..0000000 --- a/core/lib/Drupal/Core/Queue/QueuePluginBase.php +++ /dev/null @@ -1,17 +0,0 @@ -setCacheBackend($cache_backend, 'queue_plugins'); $this->alterInfo('queue_info'); @@ -51,7 +51,7 @@ public function processDefinition(&$definition, $plugin_id) { /** * {@inheritdoc} * - * @return \Drupal\Core\Queue\QueuePluginInterface + * @return \Drupal\Core\Queue\QueueWorkerInterface */ public function createInstance($plugin_id, array $configuration = []) { return parent::createInstance($plugin_id, $configuration); diff --git a/core/lib/Drupal/Core/Queue/QueueWorkerManagerInterface.php b/core/lib/Drupal/Core/Queue/QueueWorkerManagerInterface.php new file mode 100644 index 0000000..e80776b --- /dev/null +++ b/core/lib/Drupal/Core/Queue/QueueWorkerManagerInterface.php @@ -0,0 +1,17 @@ +