1

I would like to run tasks in sequence (commerce product feed before commerce node feed). I think the Queue Runner module could do the job. However, I can't find sufficient examples of how to implement it.

As far as I can see, I should create a queue with subtasks and use the serial_collection queue.

So far I created the following (with only one subtask), but the callback is never run:

function mymodule_run($file, $importer) {

  $data = array();

  $task = array();
  $task['data']['title'] = 'Subtask ' . $file->fid;
  $task['data']['worker']['callback'] = 'mymodule_callback';
  $task['data']['file'] = $file;
  $task['data']['importer'] = $importer;
  $task['data']['retries'] = 10;
  $data['subtasks'][] = $task;

  queue_runner_add($data, 'serial_collector', 5);
}

function mymodule_callback($data) {

  $importer = $data['importer'];
  $file = $data['file'];

  watchdog('mymodule', 'running importer: !importer, using file: !file', 
    array('!importer' => $importer, '!file' => $file->filename));
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.