You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not a bug per se, but the behavior is unexpected; exceeded? returns true AT the threshold in addition to over it, which is unintuitive. This is reinforced by the language in the readme, which states that "the following code checks if the currently rate is over 10 executions in the last 30 seconds or not. ratelimit.exceeded?(phone_number, threshold: 10, interval: 30)"; in reality, the code checks if the rate is over 9 executions / equal-to-or-over 10 executions in the last 30 seconds.
The consequences of this depend on where .add() is called, but I personally feel like this line should be > rather than >=:
This is not a bug per se, but the behavior is unexpected;
exceeded?
returns true AT the threshold in addition to over it, which is unintuitive. This is reinforced by the language in the readme, which states that "the following code checks if the currently rate is over 10 executions in the last 30 seconds or not.ratelimit.exceeded?(phone_number, threshold: 10, interval: 30)
"; in reality, the code checks if the rate is over 9 executions / equal-to-or-over 10 executions in the last 30 seconds.The consequences of this depend on where
.add()
is called, but I personally feel like this line should be > rather than >=:ratelimit/lib/ratelimit.rb
Line 75 in 177b1bf
RateLimit.js does not implement exceeded, but the example linked from your readme also suggests > over >=: https://gist.github.com/chriso/54dd46b03155fcf555adccea822193da#get-the-code
I can work around this in my implementation, but it thought this was worth mentioning. Otherwise, thanks for the great gem.
The text was updated successfully, but these errors were encountered: