function hook_cron_queue_info

Declare queues holding items 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 this, long running tasks are much better suited for this API. Items queued in hook_cron() might be processed in the same cron run if there are not many items in the queue, otherwise it might take several requests, which can be run in parallel.

Return value

An associative array where the key is the queue name and the value is again an associative array. Possible keys are:

  • 'worker callback': The name of an implementation of callback_queue_worker().
  • 'time': (optional) How much time Drupal should spend on calling this worker in seconds. Defaults to 15.
  • 'skip on cron': (optional) Set to TRUE to avoid being processed during cron runs (for example, if you want to control all queue execution manually).

See also

hook_cron()

hook_cron_queue_info_alter()

Related topics

2 functions implement hook_cron_queue_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

aggregator_cron_queue_info in modules/aggregator/aggregator.module
Implements hook_cron_queue_info().
cron_queue_test_cron_queue_info in modules/system/tests/cron_queue_test.module
Implements hook_cron_queue_info().
1 invocation of hook_cron_queue_info()
drupal_cron_run in includes/common.inc
Executes a cron run when called.

File

modules/system/system.api.php, line 620

Code

function hook_cron_queue_info() {
    $queues['aggregator_feeds'] = array(
        'worker callback' => 'aggregator_refresh',
        'time' => 60,
    );
    return $queues;
}

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