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

Manual Replenishment #199

Open
gorillapower opened this issue Dec 2, 2024 · 1 comment
Open

Manual Replenishment #199

gorillapower opened this issue Dec 2, 2024 · 1 comment

Comments

@gorillapower
Copy link

Are there any plans to implement a ReplenishmentRatelimiter version of the current Redis Ratelimiters?

In my case, im trying to prevent 429s on a downstream api endpoint, but it looks like due to network latency and/or timing issues, this cannot be guaranteed.

An alternative is to manually control the replenishment ourselves to guarantee that the request has started/ended before we replenish the ratelimiter.

@gorillapower
Copy link
Author

gorillapower commented Dec 2, 2024

Ive added a RedisReplenishmentSlidingWindowLimiter implementation in the following repo https://github.com/gorillapower/aspnetcore-redis-rate-limiting.

Basically, im just keeping track of two counters. One tracks the ratelimit window, as was before, the other tracks the replenishment tokens, which can only be replenished manually by calling the TryReplenish() method.

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