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
I may be missing something but it seems strange that
def allowed?(request)
t1 = request_start_time(request)
t0 = cache_get(key = cache_key(request)) rescue nil
allowed = !t0 || (dt = t1 - t0.to_f) >= minimum_interval
begin
cache_set(key, t1)
allowed
rescue => e
# If an error occurred while trying to update the timestamp stored
# in the cache, we will fall back to allowing the request through.
# This prevents the Rack application blowing up merely due to a
# backend cache server (Memcached, Redis, etc.) being offline.
allowed = true
end
end
in interval.rb doesn't call the super implementation in limiter.rb
def allowed?(request)
case
when whitelisted?(request) then true
when blacklisted?(request) then false
else true # override in subclasses
end
end
The text was updated successfully, but these errors were encountered:
The tricky part here is that you can't really just call super because it handles both the whitelist and blacklist cases. If the user is whitelisted then they shouldn't be subject to any limiting whatsoever, whereas if they're blacklisted, they should always be limited. It's almost like the superclass needs some method you can call that takes a block that is only executed if the user is neither whitelisted nor blacklisted, to avoid the sub-class having to duplicate the superclass logic.
I may be missing something but it seems strange that
in interval.rb doesn't call the super implementation in limiter.rb
The text was updated successfully, but these errors were encountered: