Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

rabbitmq: add timeouts so threads do not deadlock #35

Merged

Conversation

tjstansell
Copy link

We've had situations (so far only in AWS) where things will get stuck waiting for one of these requests to fail, which it never does, because the default for requests is to wait forever. So, this adds support for timeouts and uses a reasonable default.

also modify exception handling so we fail immediately upon http failure
@@ -20,6 +20,7 @@ class RabbitMQ(base.Plugin):
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = 80
DEFAULT_API_PATH = '/api'
DEFAULT_TIMEOUT = (3.05, 30)
Copy link

Choose a reason for hiding this comment

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

Perhaps a comment explaining that it's the connect timeout followed by the read timeout would be nice :)
And optionally a link to http://docs.python-requests.org/en/master/user/advanced/#timeouts as well

Copy link

@wolph wolph left a comment

Choose a reason for hiding this comment

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

Looks good :)

@wolph wolph requested a review from Rockstar04 June 22, 2018 14:36
@Rockstar04 Rockstar04 merged commit d98a421 into NewRelic-Python-Plugins:master Jun 22, 2018
@tjstansell tjstansell deleted the add-rabbitmq-timeouts branch June 22, 2018 15:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants