Same filename and directory in other branches
- 8.9.x core/lib/Drupal/Core/Queue/QueueWorkerManager.php
- 9 core/lib/Drupal/Core/Queue/QueueWorkerManager.php
Namespace
Drupal\Core\Queue
File
core/lib/Drupal/Core/Queue/QueueWorkerManager.php
View source
<?php
namespace Drupal\Core\Queue;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Queue\Attribute\QueueWorker;
class QueueWorkerManager extends DefaultPluginManager implements QueueWorkerManagerInterface {
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Plugin/QueueWorker', $namespaces, $module_handler, 'Drupal\\Core\\Queue\\QueueWorkerInterface', QueueWorker::class, 'Drupal\\Core\\Annotation\\QueueWorker');
$this
->setCacheBackend($cache_backend, 'queue_plugins');
$this
->alterInfo('queue_info');
}
public function processDefinition(&$definition, $plugin_id) {
parent::processDefinition($definition, $plugin_id);
if (isset($definition['cron'])) {
$time = $definition['cron']['time'] ?? 0;
if ($time <= 0) {
$definition['cron']['time'] = self::DEFAULT_QUEUE_CRON_TIME;
}
}
}
public function createInstance($plugin_id, array $configuration = []) {
return parent::createInstance($plugin_id, $configuration);
}
}
Classes