-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR allows users to configure the refill strategy for bucket4j. See
[bucket4j documentation](https://bucket4j.com/7.5.0/toc.html#refill). Greedy is the default refill strategy used by bucket4j, which will refill tokens back to the bucket4 continuously in proportion to the time elapsed. On the other hand, Interval refill strategy tops off the bucket at the end of the interval, no matter when the last token was used. GitOrigin-RevId: 3213b0bdf9bedadf6754dc0741910907e9bfca8f
- Loading branch information
1 parent
d392e63
commit b1be9c9
Showing
6 changed files
with
129 additions
and
5 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
13 changes: 13 additions & 0 deletions
13
wisp/wisp-rate-limiting/src/main/kotlin/wisp/ratelimiting/RateLimitBucketRefillStrategy.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package wisp.ratelimiting | ||
|
||
enum class RateLimitBucketRefillStrategy { | ||
/* | ||
* The bucket will be filled continuously at the specified rate | ||
*/ | ||
GREEDY, | ||
/* | ||
* The bucket will be topped off at the end of the interval, | ||
* no matter when the last token was consumed. | ||
*/ | ||
INTERVAL | ||
} |
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