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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ffd49df2965a97b61d730cbb292bf827c1e67efd36578a04b4832b65b6a23a9
4
- data.tar.gz: 96b221bcb3b9328097cc4ba11fb7d8b9c514d0b19654f1e723933139f4725938
3
+ metadata.gz: 698bf0e0ba70aab7b648cb4e491697a629c7317f56177c2b62577300dfd226f3
4
+ data.tar.gz: 49765bc3916fb28fcd06ff924f892d3d90d04156f244b60850bcd1b4539b7110
5
5
  SHA512:
6
- metadata.gz: 5be3857423b38f9f56211922c084bc9ba4717f665b6571882c760d169b8b93e0d90959d9758ebb01153ab39ed7079ab47c05d32324fef347bb8a06889d2613d9
7
- data.tar.gz: 68e6449f5bd8b32ce388f437c07b16af85bcd41b16ff84509d2cb15c4db74fd73c671d89df00919c78717b1b5e7a1a63e5e568c34dc983f27f1f70f50350356a
6
+ metadata.gz: cd2d27993d49945a2585b939759f9ac3196562f548f39fa812d12b51405e41e024e6c27eb769930592b570285576655275afb3ab9561685e8ff79cbc67405052
7
+ data.tar.gz: 3736574686273346443af48fdbe72af7f2a98bb164e45bc7734683a8b6cdd3d1d2889f1415874a35f5dfbafb1061b6af416ed957de08eda1fc66bd56d6208b9f
data/.travis.yml CHANGED
@@ -2,5 +2,5 @@
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.6.5
5
+ - 2.6.6
6
6
  before_install: gem install bundler -v 2.1.4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- better_rate_limit (0.1.3)
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.1)
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
@@ -1,3 +1,3 @@
1
1
  module BetterRateLimit
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
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
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-02-18 00:00:00.000000000 Z
12
+ date: 2021-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis