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

fix: Use retry-after response header if missing in the response body for 429 API bans #120

Merged
merged 1 commit into from Jan 14, 2022

Conversation

Daniel-Worrall
Copy link
Member

Summary

In the case of a 429 after an API ban, the retry-after in the JSON body isn't present, but is present in the headers.

The library will incorrectly wait for 0.0s since it's nil in the body and spam the API. This fixes this issue.

Fixed

Use retry-after response header if retry-after is missing in the response body

@sadleb
Copy link
Contributor

sadleb commented Jan 13, 2022

Related PR for reference:

We just had this re-surface today and continue to dig into the root cause of the 429 ban in the first place.

@sadleb
Copy link
Contributor

sadleb commented Jan 14, 2022

Related PR for reference:

We just had this re-surface today and continue to dig into the root cause of the 429 ban in the first place.

fyi: Apparently it's b/c we shared an IP address with others and either they were making too many requests and got rate-limited or the aggregate of all requests sharing that IP address led to rate-limiting for requests coming from it. This app is on Heroku.

@swarley swarley merged commit 3c73c33 into shardlab:main Jan 14, 2022
@swarley
Copy link
Member

swarley commented Jan 14, 2022

The root cause of the reported issue was due to a known problem with Discord and hosts that have shared IPs. This fix is still a good one because it's possible that Discord will send a 429 that does not include the more precise value in the body. Thanks @Daniel-Worrall! 🚀

@Daniel-Worrall Daniel-Worrall added the bug Something isn't working label Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants