The docs say:
> * - 'queue name': The name of the queue to use to queue this task. Must
* contain a valid queue name, declared by hook_cron_queue_info().
* If queue name is given, worker callback will be ignored.
AFAICT this is wrong on two counts.
1.
/**
* Implements hook_cron_queue_info().
*
* Provide queue worker information for jobs declared in
* hook_cron_job_scheduler_info().
*/
function job_scheduler_cron_queue_info() {
$queue = array();
foreach (job_scheduler_info() as $name => $info) {
if (!empty($info['jobs']) && !empty($info['queue name'])) {
$queue[$info['queue name']] = array(
'worker callback' => 'job_scheduler_cron_queue_worker',
'time' => 60, // Some reasonable default as we don't know
);
}
}
return $queue;
}
This hook implementation seems to be taking care of declaring queues to Drupal core, based on hook_cron_job_scheduler_info().
This contradicts this statement:
> Must contain a valid queue name, declared by hook_cron_queue_info().
There is the matter that hook_cron_queue_info() skips a scheduler if it has no 'jobs' property. However, AFAICT, if a scheduler info has no jobs, then job_scheduler_rebuild_scheduler() doesn't write anything to the database anyway.
2.
> If queue name is given, worker callback will be ignored
If a queue name is given, then when the scheduler runs, it doesn't execute the worker callback. Instead, it queues a new item in the Drupal queue.
This uses the queue callback job_scheduler_cron_queue_worker(). job_scheduler_cron_queue_worker() executes the job, and executing the job calls the job's worker callback!
So that bit of the docs is wrong too.
Closed: outdated
2.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.