You are here

function hosting_run_queue in Hostmaster (Aegir) 6

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 modules/hosting/hosting.drush.inc
Implementation of hook_drush_command().

File

modules/hosting/hosting.queues.inc, line 128
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');
}