mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
Fixes #69. There was a race condition when `Time.now.to_i` changes between when `epoch_time` is computed in line 18, and the cache request is made (and the `key` is expired). I.e., a throttle check starts at t0, but doesn’t reach the cache until t1, the cache will have expired the throttle count. The request will likely be allowed, even if the request exceeded the limit. This has the effect of keeping keys in cache about 1 second longer than strictly necessary. But the extra cache space seems like a good trade-off for correct throttling. |
||
|---|---|---|
| .. | ||
| store_proxy | ||
| allow2ban.rb | ||
| blacklist.rb | ||
| cache.rb | ||
| check.rb | ||
| fail2ban.rb | ||
| request.rb | ||
| store_proxy.rb | ||
| throttle.rb | ||
| track.rb | ||
| version.rb | ||
| whitelist.rb | ||