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
Use Flask pika connection pooler #190
Conversation
Looks good to me. 👍 If I had to point out something, adding the version of Flask-Pika to |
if "RABBITMQ_HOST" not in app.config: | ||
app.logger.error("RabbitMQ host:port not defined. Sleeping 2 seconds, and exiting.") | ||
sleep(2) | ||
sys.exit(-1) | ||
|
||
FLASK_PIKA_PARAMS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these be here, or in config.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally it should be in config.py, but that is already getting cluttered. When I work on deployment I'll see about adding production config for the pooling settings.
return | ||
except pika.exceptions.ConnectionClosed: | ||
except Exception as err: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the broadening of the exception? Is there not a generic flask-pika exception that we can catch here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. Pika exceptions are generally a mess, which is why I catch broad exceptions for as few lines as possible.
As stated on the tin -- there are still a ton of waring messages that are supposed to be benign. At least the code works every time, regardless of the various messages. That is an improvement. :)