You are here

function elysia_cron_queue_exec in Elysia Cron 7.2

Same name and namespace in other branches
  1. 6.2 elysia_cron.module \elysia_cron_queue_exec()

Callback for cronapi.

Parameters

string $queue_name: Queue name.

array $info: Info about queue.

1 string reference to 'elysia_cron_queue_exec'
elysia_cron_cronapi in ./elysia_cron.module
Implements hook_cronapi().

File

./elysia_cron.module, line 1917

Code

function elysia_cron_queue_exec($queue_name, $info) {
  $function = $info['worker callback'];
  $end = time() + (isset($info['time']) ? $info['time'] : 15);
  $queue = DrupalQueue::get($queue_name);
  while (time() < $end && ($item = $queue
    ->claimItem())) {
    try {
      $function($item->data);
      $queue
        ->deleteItem($item);
    } catch (Exception $e) {

      // In case of exception log it and leave the item in the queue
      // to be processed again later.
      watchdog_exception('cron', $e);
    }
  }
}