slidingWindow doesn't work with tokens: 1
SamyPesse opened this issue · 2 comments
SamyPesse commented
Using the following limiter
doesn't work and always returns success: false
:
Ratelimit.slidingWindow(1, "10 s"),
We discovered it while switching from our previous rate limiting, where we have an API endpoint that we want to limit to 1 request every N seconds. We could use Ratelimit.fixedWindow(1, "10 s")
for it, but our code is factorized to use the same algorithm for all methods.
The workaround we use is to increase from 1 to 2.
chronark commented
Hey, this looks like a rounding error, I'm checking it out
chronark commented
@SamyPesse please upgrade to v0.4.1