mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
Fix #14
This commit is contained in:
parent
51d50cc4c1
commit
2a91eb6c55
2 changed files with 1 additions and 3 deletions
|
|
@ -89,8 +89,6 @@ A [Rack::Request](http://rack.rubyforge.org/doc/classes/Rack/Request.html) objec
|
|||
|
||||
### Throttles
|
||||
|
||||
*NOTE:* If you are using Redis as backing store, Redis-ActiveSupport does not recognize `1.second` so just specify the `:period` parameter in seconds.
|
||||
|
||||
# Throttle requests to 5 requests per second per ip
|
||||
Rack::Attack.throttle('req/ip', :limit => 5, :period => 1.second) do |req|
|
||||
# If the return value is truthy, the cache key for the return value
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module Rack
|
|||
raise ArgumentError.new("Must pass #{opt.inspect} option") unless options[opt]
|
||||
end
|
||||
@limit = options[:limit]
|
||||
@period = options[:period]
|
||||
@period = options[:period].to_i
|
||||
end
|
||||
|
||||
def cache
|
||||
|
|
|
|||
Loading…
Reference in a new issue