FIX: Ignore Redis readonly errors in RateLimiter#rollback!.

This is similar to what we're doing in `RateLimiter#performed!`.
This commit is contained in:
Guo Xiang Tan
2020-06-11 15:09:12 +08:00
parent a26b490047
commit 2e8075bac3

View File

@@ -102,6 +102,12 @@ class RateLimiter
def rollback!
return if RateLimiter.disabled?
redis.lpop(prefixed_key)
rescue Redis::CommandError => e
if e.message =~ /READONLY/
# TODO,switch to in-memory rate limiter
else
raise
end
end
def remaining