dhc 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dhc/interceptors/throttle.rb +1 -1
- data/lib/dhc/version.rb +1 -1
- data/spec/interceptors/throttle/manually_spec.rb +16 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f70dd2da0d8ec740cf21499fc95ba815a73730c2e1c6a4b8cfef6ff18eef0ce
|
4
|
+
data.tar.gz: b0773620c07f30f040439d1c56c7a144ee2f144eb0d987d885aec2b940367b6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c652d89a8d1dcbeadf72472322881ce136692d1b51630c61f4cf0b058ff96d9ded1345c80238fa5d46599d494328ebaecc007a915283eae1971efe89de8cea6
|
7
|
+
data.tar.gz: 9f71766d909205e3771cd2cfd65130458ac6a73bf35119bd6edf83f1de1ecba418611b66544affd4572b4b275641875d6ae6507fd4a4d07ad1609ae263ff1694
|
data/lib/dhc/version.rb
CHANGED
@@ -33,11 +33,11 @@ describe DHC::Throttle do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'breaks' do
|
36
|
-
let(:quota_limit) {
|
36
|
+
let(:quota_limit) { 100 }
|
37
37
|
let(:break_after) { '79%' }
|
38
38
|
|
39
39
|
it 'hit the breaks if throttling quota is reached' do
|
40
|
-
|
40
|
+
79.times do
|
41
41
|
DHC.get('http://depay.fi', options)
|
42
42
|
end
|
43
43
|
expect { DHC.get('http://depay.fi', options) }.to raise_error(
|
@@ -50,19 +50,29 @@ describe DHC::Throttle do
|
|
50
50
|
let(:break_after) { '80%' }
|
51
51
|
|
52
52
|
it 'does not hit the breaks' do
|
53
|
-
|
53
|
+
80.times do
|
54
54
|
DHC.get('http://depay.fi', options)
|
55
55
|
end
|
56
56
|
end
|
57
|
+
|
58
|
+
it 'does hit the breaks surpassing quota' do
|
59
|
+
80.times do
|
60
|
+
DHC.get('http://depay.fi', options)
|
61
|
+
end
|
62
|
+
expect { DHC.get('http://depay.fi', options) }.to raise_error(
|
63
|
+
DHC::Throttle::OutOfQuota,
|
64
|
+
'Reached predefined quota for depay.fi'
|
65
|
+
)
|
66
|
+
end
|
57
67
|
end
|
58
68
|
end
|
59
69
|
|
60
70
|
context 'expires' do
|
61
71
|
let(:break_after) { '80%' }
|
62
|
-
let(:quota_limit) {
|
72
|
+
let(:quota_limit) { 100 }
|
63
73
|
|
64
74
|
it 'attempts another request if the quota expired' do
|
65
|
-
|
75
|
+
80.times do
|
66
76
|
DHC.get('http://depay.fi', options)
|
67
77
|
end
|
68
78
|
expect { DHC.get('http://depay.fi', options) }.to raise_error(
|
@@ -70,7 +80,7 @@ describe DHC::Throttle do
|
|
70
80
|
'Reached predefined quota for depay.fi'
|
71
81
|
)
|
72
82
|
Timecop.travel(Time.zone.now + 1.minute)
|
73
|
-
|
83
|
+
80.times do
|
74
84
|
DHC.get('http://depay.fi', options)
|
75
85
|
end
|
76
86
|
expect { DHC.get('http://depay.fi', options) }.to raise_error(
|