AspNetCoreRateLimit
AspNetCoreRateLimit copied to clipboard
Fixed incorrect TTL and Retry-After values for Redis
This PR fixes an issue with the Redis rate limiter that results in incorrect Retry-After headers, effectively meaning that the API will tell you to call in X seconds, even though there's Y seconds remaining. The 'actual' times are correct, but the Retry-After headers were basically unusable.
It is fixed by using the remaining TTL from Redis and the known interval to calculate how long ago the first call was made, and then adding the interval to that.