Quantcast
Viewing all articles
Browse latest Browse all 37

How to process more than one item from queue in each run?

I have set up a queue using this code.

function custom_logger_cron_queue_info() {  $queues['custom_logger'] = array('worker callback' => 'custom_logger_import','time' => 60,  );  return $queues;}

I add items using this code.

$item = array('uri' => $uri, 'uid' => $uid, 'fid' => $fid);$queue = DrupalQueue::get('custom_logger');$queue->createItem($item);

It works great, except that when cron runs every minute for this queue (I am using the Ultimate Cron module to set this) the custom_logger_import() is only processing one item per run.

function custom_logger_import($item) {  $uri = $item['uri'];  $uid = $item['uid'];  $fid = $item['fid'];  // …}

Is there something I am missing on ensuring that more items are handled? They are only small jobs that complete in less than a couple seconds, but at the moment its taking 3-4 minutes to process just 3 items.


Viewing all articles
Browse latest Browse all 37

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>