function QueueWorkerManager::processDefinition

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Queue/QueueWorkerManager.php \Drupal\Core\Queue\QueueWorkerManager::processDefinition()
  2. 8.9.x core/lib/Drupal/Core/Queue/QueueWorkerManager.php \Drupal\Core\Queue\QueueWorkerManager::processDefinition()
  3. 10 core/lib/Drupal/Core/Queue/QueueWorkerManager.php \Drupal\Core\Queue\QueueWorkerManager::processDefinition()

Overrides DefaultPluginManager::processDefinition

File

core/lib/Drupal/Core/Queue/QueueWorkerManager.php, line 41

Class

QueueWorkerManager
Defines the queue worker manager.

Namespace

Drupal\Core\Queue

Code

public function processDefinition(&$definition, $plugin_id) {
    parent::processDefinition($definition, $plugin_id);
    // Safeguard to ensure the default lease time is used in the case of a
    // malformed queue worker annotation where cron is specified without a time,
    // or an invalid time is provided.
    //
    // @see \Drupal\Core\Cron::processQueues()
    if (isset($definition['cron'])) {
        $time = $definition['cron']['time'] ?? 0;
        if ($time <= 0) {
            $definition['cron']['time'] = self::DEFAULT_QUEUE_CRON_TIME;
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.