better_rate_limit 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile.lock +2 -2
- data/lib/better_rate_limit/throttle.rb +3 -0
- data/lib/better_rate_limit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 698bf0e0ba70aab7b648cb4e491697a629c7317f56177c2b62577300dfd226f3
|
4
|
+
data.tar.gz: 49765bc3916fb28fcd06ff924f892d3d90d04156f244b60850bcd1b4539b7110
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd2d27993d49945a2585b939759f9ac3196562f548f39fa812d12b51405e41e024e6c27eb769930592b570285576655275afb3ab9561685e8ff79cbc67405052
|
7
|
+
data.tar.gz: 3736574686273346443af48fdbe72af7f2a98bb164e45bc7734683a8b6cdd3d1d2889f1415874a35f5dfbafb1061b6af416ed957de08eda1fc66bd56d6208b9f
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
better_rate_limit (0.1.
|
4
|
+
better_rate_limit (0.1.5)
|
5
5
|
actionpack (>= 5.0)
|
6
6
|
redis (>= 3.3)
|
7
7
|
|
@@ -59,7 +59,7 @@ GEM
|
|
59
59
|
rails-html-sanitizer (1.3.0)
|
60
60
|
loofah (~> 2.3)
|
61
61
|
rake (12.3.3)
|
62
|
-
redis (4.2.
|
62
|
+
redis (4.2.5)
|
63
63
|
thread_safe (0.3.6)
|
64
64
|
timecop (0.9.1)
|
65
65
|
tzinfo (1.2.7)
|
@@ -21,11 +21,14 @@ module BetterRateLimit
|
|
21
21
|
true
|
22
22
|
else
|
23
23
|
first = redis_client.lpop(key)
|
24
|
+
|
24
25
|
redis_client.multi do
|
25
26
|
redis_client.rpush key, now
|
26
27
|
redis_client.expire key, time_window.to_i
|
27
28
|
end
|
28
29
|
|
30
|
+
return false unless first
|
31
|
+
|
29
32
|
passing = first.to_time(:utc) < time_window.ago
|
30
33
|
|
31
34
|
unless passing
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_rate_limit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Fonseca
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|