function hosting_QUEUE_TYPE_queue in Hosting 7.4
Same name and namespace in other branches
- 6.2 hosting.api.php \hosting_QUEUE_TYPE_queue()
- 7.3 hosting.api.php \hosting_QUEUE_TYPE_queue()
Process the specified queue.
Modules providing a queue should implement this function an process the number of items from the queue that are specified. It is up the to the module to determine which items it wishes to process.
If you wish to process multiple items at the same time you will need to fork the process by calling drush_invoke_process() with the 'fork' option, specifying a drush command with the arguments required to process your task. Otherwise you can do all your processing in this function, or similarly call drush_invoke_process() without the 'fork' option.
Parameters
int $count: The maximum number of items to process.
See also
Related topics
File
- ./
hosting.api.php, line 355 - Hooks provided by the hosting module, and some other random ones.
Code
function hosting_QUEUE_TYPE_queue($count = 5) {
// From hosting_tasks_queue().
global $provision_errors;
drush_log(dt("Running tasks queue"));
$tasks = hosting_get_new_tasks($count);
foreach ($tasks as $task) {
drush_invoke_process('@self', "hosting-task", array(
$task->nid,
), array(), array(
'fork' => TRUE,
));
}
}