You are here

function hosting_run_queue in Hosting 6.2

Same name and namespace in other branches
  1. 5 hosting.queues.inc \hosting_run_queue()
  2. 7.4 hosting.queues.inc \hosting_run_queue()
  3. 7.3 hosting.queues.inc \hosting_run_queue()

Run a queue specified by hook_hosting_queues()

Run an instance of a queue processor. This function contains all the book keeping functionality needed to ensure that the queues are running as scheduled.

Related topics

1 string reference to 'hosting_run_queue'
hosting_drush_command in ./hosting.drush.inc
Implementation of hook_drush_command().

File

./hosting.queues.inc, line 120
This file defines an API for defining new queues.

Code

function hosting_run_queue() {
  $cmd = drush_get_command();
  $queue = $cmd['queue'];
  $count = drush_get_option(array(
    'i',
    'items',
  ), 5);

  // process a default of 5 items at a time.
  variable_set('hosting_queue_' . $queue . '_last_run', $t = time());
  variable_set('hosting_queue_' . $queue . '_running', $t);
  $func = "hosting_" . $queue . "_queue";
  if (function_exists($func)) {
    $func($count);
  }
  variable_del('hosting_queue_' . $queue . '_running');
}