fastapi-limiter
fastapi-limiter copied to clipboard
fix: when unset time limit
The RateLimiter
class was designed to allow time constraints to be null and default to 0. It can be assumed that if the user does not pass any time constraints, there are no limits.
However, when 0
is passed into the Redis script:
redis.call("SET", key, 1, "px", "0")
It triggers an exception:
redis.exceptions.ResponseError: invalid expire time in 'set' command script
Hence, this PR is proposed.