You are here

public function QueueWorkerManager::processDefinition in Drupal 10

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

Performs extra processing on plugin definitions.

By default we add defaults for the type to the definition. If a type has additional processing logic they can do that by replacing or extending the method.

Overrides DefaultPluginManager::processDefinition

File

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

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;
    }
  }
}