lib/rack/throttle/time_window.rb in rack-throttle-0.3.0 vs lib/rack/throttle/time_window.rb in rack-throttle-0.4.0

- old
+ new

@@ -6,11 +6,12 @@ # for the current window of time have been made. # # @param [Rack::Request] request # @return [Boolean] def allowed?(request) + return true if whitelisted?(request) count = cache_get(key = cache_key(request)).to_i + 1 rescue 1 - allowed = count <= max_per_window + allowed = count <= max_per_window.to_i begin cache_set(key, count) allowed rescue => e allowed = true