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 option to disable retrying of rate limited requests #1011

Closed
njhanley opened this issue Sep 28, 2021 · 1 comment · Fixed by #1151
Closed

Add option to disable retrying of rate limited requests #1011

njhanley opened this issue Sep 28, 2021 · 1 comment · Fixed by #1151

Comments

@njhanley
Copy link
Contributor

Sometimes it's better for a rate limited request to fail with an error and let the library user decide what to do.

For example, I update a channel's topic periodically with info from an external data source. The rate limiting on channel edits is quite severe, two requests in 10 minutes, and hitting that limit causes DiscordGo to sleep for several minutes before retrying my now stale request. It would be better if I could send a new request with updated data instead.

Ideally retry would be disabled on a per-request basis, but I can't see a way to implement that without major API changes. Instead a field like ShouldRetryOnRateLimit could be added to Session, defaulting to true. Unfortunately this would force the user to decide the rate limiting policy globally for their application, and it couldn't be changed in a thread-safe manner. Finally, the automatic retry logic could be removed entirely and left to the user. Obviously this would be a breaking change. Other solutions would be appreciated.

@fletcherist
Copy link

@njhanley how do you solve this problem?

njhanley added a commit to njhanley/discordgo that referenced this issue Apr 9, 2022
FedorLap2006 added a commit that referenced this issue Apr 14, 2022
* Add option to disable rate-limited request retry

Closes #1011.

* feat: code review changes

Co-authored-by: nitroflap <fe.lap.prog@gmail.com>
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 a pull request may close this issue.

2 participants