Skip to content

Fixed handling of system signals when waiting for a new message from the... #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2015

Conversation

TwistedLogic
Copy link
Contributor

... queue. Close #178

@videlalvaro
Copy link
Collaborator

Can you explain the fix?

@TwistedLogic
Copy link
Contributor Author

If you launch a consumer without the -w option, it's assumed the consumer will receive and process OS signals (SIGTERM, SIGINT, SIGHUP). If a message is currently to be processed everything works well, the message is processed and the consumer quits. When the consumer is waiting for new mesages, i.e. the queue is empty, if you send a SIGINT signal for instance, nothing happens because the BaseConsumerCommand::forceStopConsumer() method just sets the protected property $forceStop and does nothing else. The BaseConsumer::stopConsuming() method instead stops the wait on the socket, so the consumer can use the exit signal even when the queue is empty.

I'm not completely sure if there could be a message loss, can you take a look at it?

@RuslanZavacky
Copy link

@videlalvaro @TwistedLogic any news on merging it?

videlalvaro added a commit that referenced this pull request Apr 17, 2015
Fixed handling of system signals when waiting for a new message from the...
@videlalvaro videlalvaro merged commit e305476 into php-amqplib:master Apr 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Signals not handled when the queue is empty
3 participants