Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Reverting and Awaiting Bucket Rate Limits (#1127)
There are two new features introduced in this commit: The first one allows to await a rate limit instead of cancelling the command invocation. The second one allows to return a ticket to the rate limit bucket. **Awaiting Rate Limits** Buckets can now be configured to return an action. The action indicates how a framework should react. This means, buckets can indicate to cancel or delay command invocation. In order to set this feature, call the chain-method `await_ratelimits` on the bucket builder. **Returning Tickets** If a command never reaches the critical zone that requires a rate limit, we can now undo and return the ticket. This can be down by returning `RevertBucket` from a command. The concept is simple, a command may perform an expensive computation or issue a request via web API. However the command may never reach that part, imagine incorrect user input. The command would still go on cooldown, which can be a pain for the user. By returning `RevertBucket`, the cooldown can be undone.
- Loading branch information
Showing
3 changed files
with
206 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters