Skip to content
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

Merged
merged 3 commits into from Jun 6, 2017
Merged

Use Flask pika connection pooler #190

merged 3 commits into from Jun 6, 2017

Conversation

mayhem
Copy link
Member

@mayhem mayhem commented Jun 5, 2017

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. :)

@mayhem mayhem changed the title Flask pika Use Flask pika connection pooler Jun 5, 2017
@paramsingh
Copy link
Collaborator

Looks good to me. 👍

If I had to point out something, adding the version of Flask-Pika to requirements.txt would be it.

@paramsingh
Copy link
Collaborator

:shipit:

@mayhem mayhem merged commit 65f8d93 into master Jun 6, 2017
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 = {
Copy link
Collaborator

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?

Copy link
Member Author

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:
Copy link
Collaborator

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?

Copy link
Member Author

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.

@mayhem mayhem deleted the flask-pika branch July 6, 2017 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants