rack-ratelimit 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rack/ratelimit.rb +4 -4
  3. metadata +5 -60
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c542220fa4e0377bf5d0b2d0792d756824d7d8ee
4
- data.tar.gz: 0f855e376dadd38fa449c66aafb193af36cb9f10
3
+ metadata.gz: da76df57ad5b54ed09e61c19e80a8d16ecce6a2c
4
+ data.tar.gz: 8a393903a899cfa721e35597b3730a29a1edbf74
5
5
  SHA512:
6
- metadata.gz: 1bc5ca3b8276968c2d7a04cdd36891ba6aebf18fc6b563f59c21e147684c1108a73e50f393b73bd2a17d9357ea98be527eee133ca0c42e4fb05aa7cc39f222bc
7
- data.tar.gz: af142bef34e43c0e6f08f6a3706b22d68039e4b7d6b5d57037b44494f7f9f8ec7e271ef51c1e6bf52f0628867482e3e409615a2e249f5d55a9b235b71da41271
6
+ metadata.gz: 7602ad3237ac2e8263fed3209dc7b6830a4383338ff0f7fb213ccb325b642faa46eae336bce2a84d5e3468e9a4e45bd40eba7ef9274ca8f9a81d4be5929306ef
7
+ data.tar.gz: 78559b12b276864f97dce761ed7d192c36fbc4c256f880aef53236a119c6c7b8db37febf9be90c3a5ff3ce8d07847fe46140862c61e076f0be43e21124c2611a
@@ -128,14 +128,14 @@ module Rack
128
128
 
129
129
  # Increment the request counter.
130
130
  count = @counter.increment(classification, timestamp)
131
- remaining = @max - count + 1
131
+ remaining = @max - count
132
132
 
133
- json = %({"name":"#{@name}","period":#{@period},"limit":#{@max},"remaining":#{remaining},"until":"#{time}"})
133
+ json = %({"name":"#{@name}","period":#{@period},"limit":#{@max},"remaining":#{remaining < 0 ? 0 : remaining},"until":"#{time}"})
134
134
 
135
135
  # If exceeded, return a 429 Rate Limit Exceeded response.
136
- if remaining <= 0
136
+ if remaining < 0
137
137
  # Only log the first hit that exceeds the limit.
138
- if @logger && remaining == 0
138
+ if @logger && remaining == -1
139
139
  @logger.info '%s: %s exceeded %d request limit for %s' % [@name, classification, @max, time]
140
140
  end
141
141
 
metadata CHANGED
@@ -1,71 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-ratelimit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Daer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-05 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: dalli
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: redis
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 5.3.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 5.3.0
11
+ date: 2016-06-02 00:00:00.000000000 Z
12
+ dependencies: []
69
13
  description:
70
14
  email: jeremydaer@gmail.com
71
15
  executables: []
@@ -94,8 +38,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
38
  version: '0'
95
39
  requirements: []
96
40
  rubyforge_project:
97
- rubygems_version: 2.6.2
41
+ rubygems_version: 2.6.4
98
42
  signing_key:
99
43
  specification_version: 4
100
44
  summary: Flexible rate limits for your Rack apps
101
45
  test_files: []
46
+ has_rdoc: