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

feat: Use Unit timeout value on request's timeout #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henriquesalvaro
Copy link
Contributor

Hey, team!

We've had some issues in the past that we linked to outage/instability on the Unit API's side - we saw on a couple occasions our async workers getting "locked", we looked into what was happening and, basically, during these API outage/unstable periods, our API requests were simply hanging without ever failing due to timeouts. (Link to Zendesk ID)

This does check out, the Configuration object has a timeout parameter, but that is only used on the backoff.on_predicate(max_time), and the predicate truly only applies to "proper" responses received from the server, so if a request takes forever, this max_time won't ever be used.

The requests lib does not have a default timeout (seen here), and I believe it's best practice to have this set - to avoid having requests hanging.

The implementation here is simply passing in timeout=self.configuration.get_timeout() to the requests on the BaseResource. The caveat: the timeout will now raise a requests.Exception.ConnectTimeout/ReadTimeout, and I'm not sure if y'all want to handle this actively, or if it's fair game to just let this exception bubble up.

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.

1 participant