1

I am using hook_cron in my module to create a queue. The queue will process a couple of non-drupal database tables and synch some data around (a process that can take close to 10 minutes). I'm creating a single item (createItem) and don't need to pass anything to the function. I'm passing null to createItem and I've also tried passing an StdClass object.

$queue = DrupalQueue::get("alltimesynch");
$queue->createItem(null);

However, hook_cron_queue_info never runs. I know this because the watchdog function never adds the string to the log

function timesdb_cron_queue_info() {
  watchdog("timesdb","timesdb_cron_queue_info called");
  $queues['alltimesynch'] = array (
    'worker callback' => 'timesdb_import_alltime_start',
  );
}
function timesdb_import_alltime_start($null) {
  watchdog("timesdb","Starting alltime import");
  timesdb_import_alltime();
}

What am I doing wrong?

1 Answer 1

2

You have to return $queues in your hook_cron_queue_info..

function timesdb_cron_queue_info() {
  watchdog("timesdb","timesdb_cron_queue_info called");
  $queues['alltimesynch'] = array (
    'worker callback' => 'timesdb_import_alltime_start',
  );
  return $queues;
}
1
  • Thanks, that was it. The blog I used to learn this process left that part out.
    – Robbert
    Sep 1, 2014 at 7:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.