Skip to content

Conversation

@werewolf81
Copy link

At the moment, if a queue worker is running while a connection error happens to RabbitMQ, the worker becomes corrupted and cannot process data correctly anymore.

The job being run by the worker is never marked as failed, it also does not work anymore even if the connection to RabbitMQ is restored.

This fix allows to optionally throw an exception if this scenario happens and the worker will be killed by Laravel.
Then if used along with Supervisor, a new worker is spawned and new connection will be established allowing the system to work again.


// If it's set to false, throw an error rather than waiting
if ($this->sleepOnError === false) {
throw new \Exception('Error writing data to the connection with RabbitMQ');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably changing Exception to RuntimeException will make better sense?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's fine. I've applied the change.

@vyuldashev vyuldashev merged commit 911770d into vyuldashev:master Jun 29, 2017
@vyuldashev
Copy link
Owner

Thanks, merged!

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.

2 participants