function hosting_queued_restart in Hosting 6.2
Same name and namespace in other branches
- 7.4 queued/hosting_queued.drush.inc \hosting_queued_restart()
- 7.3 queued/hosting_queued.drush.inc \hosting_queued_restart()
Restart the dispatcher to work around memory leaks
1 call to hosting_queued_restart()
- drush_hosting_queued in queued/
hosting_queued.drush.inc - Drush command to execute hosting tasks.
1 string reference to 'hosting_queued_restart'
- drush_hosting_queued in queued/
hosting_queued.drush.inc - Drush command to execute hosting tasks.
File
- queued/
hosting_queued.drush.inc, line 155 - Dispatcher daemon
Code
function hosting_queued_restart($signal = NULL) {
// If we received a singal, process it.
if (!is_null($signal)) {
watchdog('hosting_queued', 'Received signal @signal, waiting for children to die.', array(
'@signal' => $signal,
));
$status = NULL;
pcntl_wait($status);
}
// We need the PCNTL extension to be able to auto restart.
if (function_exists('pcntl_exec')) {
$args = $_ENV['argv'];
$drush = array_shift($args);
// Strip sub-array to avoid warning "Array to string conversion"
unset($_ENV['argv']);
watchdog('hosting_queued', 'Restarting queue daemon with @drush @args.', array(
'@drush' => $drush,
'@args' => implode(" ", $args),
));
pcntl_exec($drush, $args, $_ENV);
watchdog('hosting_queued', 'Could not restart the queue daemon, aborting.', array(), WATCHDOG_ERROR);
/* NOTREACHED */
}
else {
watchdog('hosting_queued', 'PCNTL not installed, unable to auto-restart.', array(), WATCHDOG_WARNING);
}
// Explicit exit in case we're handling a signal
exit(1);
}