I'm trying to use queue api with cron, everything seems work but drupal does not enter on the "worker" function. The problem there is only if I enable Elysia Cron (and I've to enable it..)
<?php
/**
* Implements hook_cron_queue_info().
*/
function monitor_import_cron_queue_info() {
$queue['monitor_import_queue'] = array(
'worker callback' => 'monitor_import_queue_worker',
'time' => 10,
);
return $queue;
}
/**
* Implements hook_cron().
*/
function monitor_import_cron() {
$call = new MyWS();
$params = new getSoggettoView();
$params->limit = '10'; //$limit;
$params->offset = '0';
$results = $call->getSoggettoView($params);
$items = $results->return;
$queue = DrupalQueue::get('monitor_import_queue'); // grab queue
$queue->createQueue(); // initialize
foreach ($items as $item) {
$queue->createItem($item);
}
}
/**
* Worker callback
*
* @see mymodule_cron_queue_info().
*/
function monitor_import_queue_worker($item) {
$a = 1;
}
$call->getSoggettoView($params);
doesn't return any data to add to the queue, then the worker callback won't get an item to process, i.e won't be called.