Document / validate positive value for block_for
Hi!
I noticed that if you use 0 as a value for block_for, then Redis raises the exception ERR invalid expire time in setex as soon as a request gets throttled. That is caused by block_duration reaching 0 here and setex failing.
> setex some_key 1 some_value
OK
> setex some_key 0 some_value
(error) ERR invalid expire time in setex
it would be nice to have validation for block_for or some additional documentation.
It would be very nice to document the purpose of block_for parameter
if anyone reading this is wondering : as far as I can understand from the source code, when a first call to throttle! fails the throttler will block for block_for seconds, meaning all calls to throttle! during that period will immediately fail (without checking the Redis counter). And apparently it must be set to a positive value.