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

_http_resp_rate_limited does not take request timeout into consideration #27

Closed
dave-shawley opened this issue Jan 16, 2020 · 1 comment

Comments

@dave-shawley
Copy link
Contributor

The current code blindly sleeps for whatever is specified in Retry-After

@staticmethod
def _http_resp_rate_limited(response):
"""Extract the ``Retry-After`` header value if the request was rate
limited and return a future to sleep for the specified duration.
:param tornado.httpclient.HTTPResponse response: The response
:rtype: tornado.concurrent.Future
"""
parsed = parse.urlparse(response.request.url)
duration = int(response.headers.get('Retry-After', 3))
LOGGER.warning('Rate Limited by %s, retrying in %i seconds',
parsed.netloc, duration)
return asyncio.sleep(duration)

@dave-shawley dave-shawley changed the title _http_resp_rate_limited does not take request timeout into consideration _http_resp_rate_limited does not take request timeout into consideration Jan 16, 2020
@dave-shawley dave-shawley mentioned this issue Apr 6, 2020
bkorty added a commit that referenced this issue Apr 7, 2020
@dave-shawley
Copy link
Contributor Author

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

No branches or pull requests

1 participant