Skip to content

Commit

Permalink
Dispatch unix signals for consumer commands
Browse files Browse the repository at this point in the history
  • Loading branch information
igrizzli committed Aug 17, 2012
1 parent 0f712e6 commit 4690dc8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Command/BaseConsumerCommand.php
Expand Up @@ -61,6 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if($signals){
if(extension_loaded('pcntl')){
pcntl_signal(SIGTERM, array(&$this, 'stopConsumer'));
pcntl_signal(SIGINT, array(&$this, 'stopConsumer'));
pcntl_signal(SIGHUP, array(&$this, 'restartConsumer'));
}else{
throw new \InvalidArgumentException("The -s option can be used, if pcntl extension installed");
Expand Down
2 changes: 1 addition & 1 deletion RabbitMq/BaseConsumer.php
Expand Up @@ -58,7 +58,7 @@ protected function maybeStopConsumer()
if(extension_loaded('pcntl')) {
pcntl_signal_dispatch();
}

if($this->forceStop || ($this->consumed == $this->target && $this->target > 0)) {
$this->stopConsuming();
} else {
Expand Down

0 comments on commit 4690dc8

Please sign in to comment.