mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
Cache key time must be a fixnum
This commit is contained in:
parent
ab3a540834
commit
f7a1eac521
1 changed files with 1 additions and 1 deletions
|
|
@ -11,7 +11,7 @@ module Rack
|
||||||
def count(unprefixed_key, period)
|
def count(unprefixed_key, period)
|
||||||
epoch_time = Time.now.to_i
|
epoch_time = Time.now.to_i
|
||||||
expires_in = period - (epoch_time % period)
|
expires_in = period - (epoch_time % period)
|
||||||
key = "#{prefix}:#{epoch_time/period}:#{unprefixed_key}"
|
key = "#{prefix}:#{(epoch_time/period).to_i}:#{unprefixed_key}"
|
||||||
result = store.increment(key, 1, :expires_in => expires_in)
|
result = store.increment(key, 1, :expires_in => expires_in)
|
||||||
# NB: Some stores return nil when incrementing uninitialized values
|
# NB: Some stores return nil when incrementing uninitialized values
|
||||||
if result.nil?
|
if result.nil?
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue