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

Add retries for addtional response codes #106

Merged
merged 5 commits into from
Jun 10, 2020

Conversation

eengoron
Copy link
Contributor

This PR adds retries for 503 status codes and 502 and 504 status codes on GET requests.

In terms of intervals for retries, for 503s, each retry we chose a random number between 2 - 4 seconds.

For 502 or 504 GETs, we choose a random integer between 60 and 90 seconds and multiply that by the number of current retries.

I also bumped up the version number to 1.3 even though we never actually released 1.2 to PyPI.

eengoron added 2 commits June 10, 2020 15:27
…requests. For 503s, requests can be retried after between 2-4 seconds, for 502 and 504s, we want a retry every 60-90 seconds, with that number increasing each time we retry
@eengoron eengoron requested review from tsx and thomasst June 10, 2020 19:31
closeio_api/__init__.py Outdated Show resolved Hide resolved
request again.
"""
if status_code == 503:
return randint(2, 4)
Copy link
Member

Choose a reason for hiding this comment

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

This should also have a backoff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in bceed63. Note: I also didn't exponentially back off on this one either, because 503s should be able to be retried practically instantaneously, so it felt like overkill.

If you'd rather that, let me know.

closeio_api/__init__.py Outdated Show resolved Hide resolved
@eengoron eengoron requested a review from thomasst June 10, 2020 19:50
closeio_api/__init__.py Outdated Show resolved Hide resolved
closeio_api/__init__.py Outdated Show resolved Hide resolved
@eengoron eengoron merged commit e24601c into master Jun 10, 2020
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