hook_cron_queue_info stopped I'm trying to use Drupal Queue and Cron to execute a task.
In the following example I:


select all the users
create an item in the queue for each of them 
define the function that has to be run for the items of the queue


What happen is that at some point the system stops running the queue and the only way to start again the process is to kill it. (I'm using Ultimate cron to controll Cron processes).

I understood that after some time the system should stop the script and start it again at the following cron job. Am I wrong?

Here there is the code:

 function mymodule_cron() {
        $sql = db_query("select u.uid, u.mail FROM {users} u WHERE u.status=1");

    $queue = DrupalQueue::get("testlogging");

    $number_of_rows = $sql-&gt;rowCount();
    if ($number_of_rows &gt; 0) {
        foreach ($sql as $record) {
            $queue-&gt;createItem($record);
        }
    }
}

function mymodule_cron_queue_info() {
    $queues = array();
    $queues['testlogging'] = array (
      'worker callback' =&gt; 'log_user',
      'time' =&gt; 300,  
    );
    return $queues;
}

function log_user($record) {
    watchdog('MyModule', 'queue info: uid = ' . $record-&gt;uid . " " . $record-&gt;mail);
    sleep(2);
}
If you are sure that your execution do not produce programming errors, the problem may come from the fact that Drupal only executes queue items when running Cron. Taking into account that Drupal Cron is limited by time and PHP memory, your queue items may not be fully processed in a single Cron run.

You can refer to this issue I created some time ago about a very similar problem.

In short, I solved it by processing queue items every X minutes.