You are here

function hosting_queued_stop in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 queued/hosting_queued.drush.inc \hosting_queued_stop()
  2. 7.4 queued/hosting_queued.drush.inc \hosting_queued_stop()

Handle interruption signals gracefully

We do not want to interrupt children tasks, so we wait for them before stopping.

1 string reference to 'hosting_queued_stop'
drush_hosting_queued in queued/hosting_queued.drush.inc
Drush command to execute hosting tasks.

File

queued/hosting_queued.drush.inc, line 222
Dispatcher daemon

Code

function hosting_queued_stop($signal) {
  watchdog('hosting_queued', 'Received signal @signal, waiting for children to die.', array(
    '@signal' => $signal,
  ));
  $status = NULL;
  pcntl_wait($status);
  drush_log('Releasing lock on task queue.');
  lock_release('hosting_queue_tasks_running');
  watchdog('hosting_queued', 'Stopped daemon');
  exit($status);
}