aspnetcore-redis-rate-limiting icon indicating copy to clipboard operation
aspnetcore-redis-rate-limiting copied to clipboard

Add possibility to extend existing rate limiter implementations

Open FD-YTD opened this issue 1 month ago • 1 comments

Hi

The current rate limiter implementations (fixed window, sliding window, and token bucket) are not easily extensible at the moment. For example, I’d like to add metadata indicating the available retry delay. While such information technically exists, it doesn’t align with what the Polly library expects when constructing its exceptions (https://github.com/App-vNext/Polly/blob/main/src/Polly.RateLimiting/RateLimiterResilienceStrategy.cs#L55). Specifically, the type used differs: TimeSpan is expected, but an int is currently provided. Right now, to support this, we have to duplicate the entire Redis fixed window limiter implementation, which is far from ideal. It would be extremely helpful if there were extension points available to inject custom metadata, or if the limiter code were more open to customization - e.g., by making certain methods and types non-internal or non-private. Do you think such changes could be considered? I’d be happy to submit a PR with a proposal. Best regards.

FD-YTD avatar Nov 06 '25 16:11 FD-YTD

Hi @FD-YTD, please submit a PR with your suggestions!

cristipufu avatar Nov 08 '25 06:11 cristipufu