retriable 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +38 -0
- data/.travis.yml +6 -2
- data/CHANGELOG.md +6 -0
- data/Gemfile +5 -1
- data/Guardfile +1 -1
- data/README.md +1 -1
- data/Rakefile +4 -8
- data/lib/retriable.rb +8 -16
- data/lib/retriable/exponential_backoff.rb +4 -3
- data/lib/retriable/version.rb +1 -1
- data/retriable.gemspec +13 -8
- data/spec/exponential_backoff_spec.rb +7 -7
- data/spec/retriable_spec.rb +37 -34
- metadata +9 -11
- data/wercker.yml +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b679f765910990f95431fe330d2ec2a1340056d
|
4
|
+
data.tar.gz: f3eb6ca16690e20b673d51cd7c93f240a846ab3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 613b716a3e0a2164f03def1a0db227868733f066830130da7bc05afeff520948100288eef753f1e94387b7cdd365207202aa8ff38cac69def7680e60305ff70e
|
7
|
+
data.tar.gz: c4ec29c385614fcbe2525b073e509a99b0e803ef889d8365ed45c7493167afa299424c55ec6bc8321d29769f76c2712c9b4fad8eb2f05358f2d4289e6536e990
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
Style/StringLiterals:
|
2
|
+
EnforcedStyle: double_quotes
|
3
|
+
|
4
|
+
Style/Documentation:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Style/TrailingCommaInArguments:
|
8
|
+
EnforcedStyleForMultiline: comma
|
9
|
+
|
10
|
+
Style/TrailingCommaInLiteral:
|
11
|
+
EnforcedStyleForMultiline: comma
|
12
|
+
|
13
|
+
Style/InheritException:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Style/IndentArray:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Style/IndentHash:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Metrics/ClassLength:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Metrics/ModuleLength:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Metrics/LineLength:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Metrics/MethodLength:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Metrics/BlockLength:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Metrics/AbcSize:
|
38
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -10,16 +10,20 @@ rvm:
|
|
10
10
|
- 2.4.0
|
11
11
|
- rbx
|
12
12
|
- jruby-9.0.5.0
|
13
|
-
- jruby-9.1.
|
13
|
+
- jruby-9.1.7.0
|
14
14
|
- ruby-head
|
15
15
|
- jruby-head
|
16
16
|
|
17
17
|
matrix:
|
18
18
|
allow_failures:
|
19
|
-
- rvm:
|
19
|
+
- rvm: rbx
|
20
20
|
- rvm: ruby-head
|
21
21
|
- rvm: jruby-head
|
22
22
|
|
23
|
+
before_install:
|
24
|
+
- gem update --system
|
25
|
+
- gem install bundler
|
26
|
+
|
23
27
|
addons:
|
24
28
|
code_climate:
|
25
29
|
repo_token: 20a1139ef1830b4f813a10a03d90e8aa179b5226f75e75c5a949b25756ebf558
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## HEAD
|
2
2
|
|
3
|
+
## 3.0.1
|
4
|
+
* Add `rubocop` linter to enforce coding styles for this library. Also, fix rule violations.
|
5
|
+
* Removed `attr_reader :config` that caused a warning. @bruno-
|
6
|
+
* Clean up Rakefile testing cruft. @bruno-
|
7
|
+
* Use `.any?` in the `:on` hash processing. @apurvis
|
8
|
+
|
3
9
|
## 3.0.0
|
4
10
|
* Require ruby 2.0+.
|
5
11
|
* Breaking Change: `on` with a `Hash` value now matches subclassed exceptions. Thanks @apurvis!
|
data/Gemfile
CHANGED
@@ -5,11 +5,15 @@ gemspec
|
|
5
5
|
|
6
6
|
group :test do
|
7
7
|
# gem "ruby_gntp"
|
8
|
-
gem "minitest-focus"
|
9
8
|
gem "codeclimate-test-reporter", require: false
|
9
|
+
gem "minitest-focus"
|
10
10
|
gem "simplecov", require: false
|
11
11
|
end
|
12
12
|
|
13
|
+
group :development do
|
14
|
+
gem "rubocop"
|
15
|
+
end
|
16
|
+
|
13
17
|
group :development, :test do
|
14
18
|
gem "pry"
|
15
19
|
end
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#Retriable
|
2
2
|
|
3
|
-
[](http://travis-ci.org/kamui/retriable)
|
4
4
|
[](https://codeclimate.com/github/kamui/retriable)
|
5
5
|
[](https://codeclimate.com/github/kamui/retriable)
|
6
6
|
|
data/Rakefile
CHANGED
@@ -6,11 +6,7 @@ Bundler::GemHelper.install_tasks
|
|
6
6
|
require "rake/testtask"
|
7
7
|
task default: :test
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
t.pattern = "spec/**/*_spec.rb"
|
14
|
-
t.verbose = true
|
15
|
-
end
|
16
|
-
end
|
9
|
+
Rake::TestTask.new do |t|
|
10
|
+
t.pattern = "spec/**/*_spec.rb"
|
11
|
+
t.verbose = true
|
12
|
+
end
|
data/lib/retriable.rb
CHANGED
@@ -4,9 +4,7 @@ require_relative "retriable/exponential_backoff"
|
|
4
4
|
require_relative "retriable/version"
|
5
5
|
|
6
6
|
module Retriable
|
7
|
-
|
8
|
-
|
9
|
-
attr_reader :config
|
7
|
+
module_function
|
10
8
|
|
11
9
|
def self.configure
|
12
10
|
yield(config)
|
@@ -39,28 +37,22 @@ module Retriable
|
|
39
37
|
base_interval: base_interval,
|
40
38
|
multiplier: multiplier,
|
41
39
|
max_interval: max_interval,
|
42
|
-
rand_factor: rand_factor
|
40
|
+
rand_factor: rand_factor,
|
43
41
|
).intervals
|
44
42
|
end
|
45
43
|
|
46
|
-
exception_list = on.
|
44
|
+
exception_list = on.is_a?(Hash) ? on.keys : on
|
47
45
|
|
48
46
|
tries.times do |index|
|
49
47
|
try = index + 1
|
50
48
|
begin
|
51
|
-
if timeout
|
52
|
-
|
53
|
-
else
|
54
|
-
return yield(try)
|
55
|
-
end
|
49
|
+
return Timeout.timeout(timeout) { return yield(try) } if timeout
|
50
|
+
return yield(try)
|
56
51
|
rescue *[*exception_list] => exception
|
57
|
-
if on.
|
58
|
-
|
59
|
-
|
60
|
-
match || [*on[e]].empty? || [*on[e]].any? { |pattern| exception.message =~ pattern }
|
52
|
+
if on.is_a?(Hash)
|
53
|
+
raise unless exception_list.any? do |e|
|
54
|
+
exception.is_a?(e) && ([*on[e]].empty? || [*on[e]].any? { |pattern| exception.message =~ pattern })
|
61
55
|
end
|
62
|
-
|
63
|
-
raise unless message_match
|
64
56
|
end
|
65
57
|
|
66
58
|
interval = intervals[index]
|
@@ -16,17 +16,18 @@ module Retriable
|
|
16
16
|
|
17
17
|
def intervals
|
18
18
|
intervals = Array.new(tries) do |iteration|
|
19
|
-
[base_interval * multiplier
|
19
|
+
[base_interval * multiplier**iteration, max_interval].min
|
20
20
|
end
|
21
21
|
|
22
|
-
return intervals if rand_factor
|
22
|
+
return intervals if rand_factor.zero?
|
23
23
|
|
24
24
|
intervals.map { |i| randomize(i) }
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
28
|
+
|
28
29
|
def randomize(interval)
|
29
|
-
return interval if rand_factor
|
30
|
+
return interval if rand_factor.zero?
|
30
31
|
delta = rand_factor * interval * 1.0
|
31
32
|
min = interval - delta
|
32
33
|
max = interval + delta
|
data/lib/retriable/version.rb
CHANGED
data/retriable.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require "retriable/version"
|
5
5
|
|
@@ -8,10 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Retriable::VERSION
|
9
9
|
spec.authors = ["Jack Chu"]
|
10
10
|
spec.email = ["jack@jackchu.com"]
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
|
14
|
-
spec.homepage = %q{http://github.com/kamui/retriable}
|
11
|
+
spec.summary = "Retriable is an simple DSL to retry failed code blocks with randomized exponential backoff"
|
12
|
+
spec.description = "Retriable is an simple DSL to retry failed code blocks with randomized exponential backoff. This is especially useful when interacting external api/services or file system calls."
|
13
|
+
spec.homepage = "http://github.com/kamui/retriable"
|
15
14
|
spec.license = "MIT"
|
16
15
|
|
17
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -19,13 +18,19 @@ Gem::Specification.new do |spec|
|
|
19
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
19
|
spec.require_paths = ["lib"]
|
21
20
|
|
22
|
-
spec.required_ruby_version =
|
21
|
+
spec.required_ruby_version = ">= 2.0.0"
|
23
22
|
|
24
|
-
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "bundler"
|
25
24
|
spec.add_development_dependency "rake", "~> 12.0"
|
26
25
|
|
27
26
|
spec.add_development_dependency "minitest", "~> 5.10"
|
28
27
|
spec.add_development_dependency "guard"
|
29
28
|
spec.add_development_dependency "guard-minitest"
|
30
|
-
|
29
|
+
|
30
|
+
if RUBY_VERSION < "2.3"
|
31
|
+
spec.add_development_dependency "ruby_dep", "~> 1.3.1"
|
32
|
+
spec.add_development_dependency "listen", "~> 3.0.8"
|
33
|
+
else
|
34
|
+
spec.add_development_dependency "listen", "~> 3.1"
|
35
|
+
end
|
31
36
|
end
|
@@ -35,7 +35,7 @@ describe Retriable::ExponentialBackoff do
|
|
35
35
|
4.350816718580626,
|
36
36
|
5.339852157217869,
|
37
37
|
11.889873261212443,
|
38
|
-
18.756037881636484
|
38
|
+
18.756037881636484,
|
39
39
|
])
|
40
40
|
end
|
41
41
|
|
@@ -47,7 +47,7 @@ describe Retriable::ExponentialBackoff do
|
|
47
47
|
expect(subject.new(base_interval: 1).intervals).must_equal([
|
48
48
|
1.0488135024422882,
|
49
49
|
1.8227840477522461,
|
50
|
-
2.4812175837998227
|
50
|
+
2.4812175837998227,
|
51
51
|
])
|
52
52
|
end
|
53
53
|
|
@@ -55,7 +55,7 @@ describe Retriable::ExponentialBackoff do
|
|
55
55
|
expect(subject.new(multiplier: 1).intervals).must_equal([
|
56
56
|
0.5244067512211441,
|
57
57
|
0.607594682584082,
|
58
|
-
0.5513816852888495
|
58
|
+
0.5513816852888495,
|
59
59
|
])
|
60
60
|
end
|
61
61
|
|
@@ -63,7 +63,7 @@ describe Retriable::ExponentialBackoff do
|
|
63
63
|
expect(subject.new(max_interval: 1.0, rand_factor: 0.0).intervals).must_equal([
|
64
64
|
0.5,
|
65
65
|
0.75,
|
66
|
-
1.0
|
66
|
+
1.0,
|
67
67
|
])
|
68
68
|
end
|
69
69
|
|
@@ -71,14 +71,14 @@ describe Retriable::ExponentialBackoff do
|
|
71
71
|
expect(subject.new(rand_factor: 0.2).intervals).must_equal([
|
72
72
|
0.5097627004884576,
|
73
73
|
0.8145568095504492,
|
74
|
-
1.1712435167599646
|
74
|
+
1.1712435167599646,
|
75
75
|
])
|
76
76
|
end
|
77
77
|
|
78
78
|
it "generates 10 non-randomized intervals" do
|
79
79
|
expect(subject.new(
|
80
80
|
tries: 10,
|
81
|
-
rand_factor: 0.0
|
81
|
+
rand_factor: 0.0,
|
82
82
|
).intervals).must_equal([
|
83
83
|
0.5,
|
84
84
|
0.75,
|
@@ -89,7 +89,7 @@ describe Retriable::ExponentialBackoff do
|
|
89
89
|
5.6953125,
|
90
90
|
8.54296875,
|
91
91
|
12.814453125,
|
92
|
-
19.2216796875
|
92
|
+
19.2216796875,
|
93
93
|
])
|
94
94
|
end
|
95
95
|
end
|
data/spec/retriable_spec.rb
CHANGED
@@ -43,7 +43,7 @@ describe Retriable do
|
|
43
43
|
expect do
|
44
44
|
subject.retriable do
|
45
45
|
tries += 1
|
46
|
-
raise StandardError.new
|
46
|
+
raise StandardError.new, "StandardError occurred"
|
47
47
|
end
|
48
48
|
end.must_raise StandardError
|
49
49
|
|
@@ -56,7 +56,7 @@ describe Retriable do
|
|
56
56
|
expect do
|
57
57
|
subject.retriable do
|
58
58
|
tries += 1
|
59
|
-
raise TestError.new
|
59
|
+
raise TestError.new, "TestError occurred"
|
60
60
|
end
|
61
61
|
end.must_raise TestError
|
62
62
|
|
@@ -69,7 +69,7 @@ describe Retriable do
|
|
69
69
|
expect do
|
70
70
|
subject.retriable on: TestError do
|
71
71
|
tries += 1
|
72
|
-
raise TestError.new
|
72
|
+
raise TestError.new, "TestError occurred"
|
73
73
|
end
|
74
74
|
end.must_raise TestError
|
75
75
|
|
@@ -80,11 +80,9 @@ describe Retriable do
|
|
80
80
|
tries = 0
|
81
81
|
|
82
82
|
expect do
|
83
|
-
subject.retriable(
|
84
|
-
tries: 10,
|
85
|
-
) do
|
83
|
+
subject.retriable(tries: 10) do
|
86
84
|
tries += 1
|
87
|
-
raise StandardError.new
|
85
|
+
raise StandardError.new, "StandardError occurred"
|
88
86
|
end
|
89
87
|
end.must_raise StandardError
|
90
88
|
|
@@ -103,7 +101,7 @@ describe Retriable do
|
|
103
101
|
tries = 0
|
104
102
|
time_table = []
|
105
103
|
|
106
|
-
handler =
|
104
|
+
handler = lambda do |exception, _try, _elapsed_time, next_interval|
|
107
105
|
expect(exception.class).must_equal ArgumentError
|
108
106
|
time_table << next_interval
|
109
107
|
end
|
@@ -115,7 +113,7 @@ describe Retriable do
|
|
115
113
|
tries: 10,
|
116
114
|
) do
|
117
115
|
tries += 1
|
118
|
-
raise ArgumentError.new
|
116
|
+
raise ArgumentError.new, "ArgumentError occurred"
|
119
117
|
end
|
120
118
|
end.must_raise ArgumentError
|
121
119
|
|
@@ -141,7 +139,7 @@ describe Retriable do
|
|
141
139
|
@try_count = 0
|
142
140
|
@time_table = {}
|
143
141
|
|
144
|
-
handler =
|
142
|
+
handler = lambda do |exception, try, _elapsed_time, next_interval|
|
145
143
|
expect(exception.class).must_equal ArgumentError
|
146
144
|
@time_table[try] = next_interval
|
147
145
|
end
|
@@ -153,7 +151,7 @@ describe Retriable do
|
|
153
151
|
tries: tries,
|
154
152
|
) do
|
155
153
|
@try_count += 1
|
156
|
-
raise ArgumentError.new if @try_count < tries
|
154
|
+
raise ArgumentError.new, "ArgumentError occurred" if @try_count < tries
|
157
155
|
end
|
158
156
|
end
|
159
157
|
|
@@ -162,13 +160,13 @@ describe Retriable do
|
|
162
160
|
end
|
163
161
|
|
164
162
|
it "applies a non-randomized exponential backoff to each try" do
|
165
|
-
expect(@time_table).must_equal(
|
163
|
+
expect(@time_table).must_equal(
|
166
164
|
1 => 0.5,
|
167
165
|
2 => 0.75,
|
168
166
|
3 => 1.125,
|
169
167
|
4 => 1.6875,
|
170
168
|
5 => 2.53125,
|
171
|
-
|
169
|
+
)
|
172
170
|
end
|
173
171
|
end
|
174
172
|
|
@@ -176,7 +174,7 @@ describe Retriable do
|
|
176
174
|
tries = 0
|
177
175
|
time_table = {}
|
178
176
|
|
179
|
-
handler =
|
177
|
+
handler = lambda do |_exception, try, _elapsed_time, next_interval|
|
180
178
|
time_table[try] = next_interval
|
181
179
|
end
|
182
180
|
|
@@ -189,17 +187,17 @@ describe Retriable do
|
|
189
187
|
max_interval: 1.5,
|
190
188
|
) do
|
191
189
|
tries += 1
|
192
|
-
raise StandardError.new
|
190
|
+
raise StandardError.new, "StandardError occurred"
|
193
191
|
end
|
194
192
|
end.must_raise StandardError
|
195
193
|
|
196
|
-
expect(time_table).must_equal(
|
194
|
+
expect(time_table).must_equal(
|
197
195
|
1 => 0.5,
|
198
196
|
2 => 0.75,
|
199
197
|
3 => 1.125,
|
200
198
|
4 => 1.5,
|
201
199
|
5 => nil,
|
202
|
-
|
200
|
+
)
|
203
201
|
end
|
204
202
|
|
205
203
|
it "#retriable with custom defined intervals" do
|
@@ -212,7 +210,7 @@ describe Retriable do
|
|
212
210
|
]
|
213
211
|
time_table = {}
|
214
212
|
|
215
|
-
handler =
|
213
|
+
handler = lambda do |_exception, try, _elapsed_time, next_interval|
|
216
214
|
time_table[try] = next_interval
|
217
215
|
end
|
218
216
|
|
@@ -224,18 +222,18 @@ describe Retriable do
|
|
224
222
|
intervals: intervals,
|
225
223
|
) do
|
226
224
|
try_count += 1
|
227
|
-
raise StandardError.new
|
225
|
+
raise StandardError.new, "StandardError occurred"
|
228
226
|
end
|
229
227
|
end.must_raise StandardError
|
230
228
|
|
231
|
-
expect(time_table).must_equal(
|
229
|
+
expect(time_table).must_equal(
|
232
230
|
1 => 0.5,
|
233
231
|
2 => 0.75,
|
234
232
|
3 => 1.125,
|
235
233
|
4 => 1.5,
|
236
234
|
5 => 1.5,
|
237
235
|
6 => nil,
|
238
|
-
|
236
|
+
)
|
239
237
|
|
240
238
|
expect(try_count).must_equal(6)
|
241
239
|
end
|
@@ -243,7 +241,7 @@ describe Retriable do
|
|
243
241
|
it "#retriable with a hash exception where the value is an exception message pattern" do
|
244
242
|
e = expect do
|
245
243
|
subject.retriable on: { TestError => /something went wrong/ } do
|
246
|
-
raise TestError
|
244
|
+
raise TestError, "something went wrong"
|
247
245
|
end
|
248
246
|
end.must_raise TestError
|
249
247
|
|
@@ -252,12 +250,17 @@ describe Retriable do
|
|
252
250
|
|
253
251
|
it "#retriable with a hash exception list matches exception subclasses" do
|
254
252
|
class SecondTestError < TestError; end
|
253
|
+
class DifferentTestError < Exception; end
|
255
254
|
|
256
255
|
tries = 0
|
257
256
|
e = expect do
|
258
|
-
subject.retriable on: {
|
257
|
+
subject.retriable on: {
|
258
|
+
DifferentTestError => /should never happen/,
|
259
|
+
TestError => /something went wrong/,
|
260
|
+
DifferentTestError => /also should never happen/,
|
261
|
+
}, tries: 4 do
|
259
262
|
tries += 1
|
260
|
-
raise SecondTestError
|
263
|
+
raise SecondTestError, "something went wrong"
|
261
264
|
end
|
262
265
|
end.must_raise SecondTestError
|
263
266
|
|
@@ -269,10 +272,10 @@ describe Retriable do
|
|
269
272
|
class SecondTestError < TestError; end
|
270
273
|
|
271
274
|
tries = 0
|
272
|
-
|
275
|
+
expect do
|
273
276
|
subject.retriable on: { TestError => /something went wrong/ }, tries: 4 do
|
274
277
|
tries += 1
|
275
|
-
raise SecondTestError
|
278
|
+
raise SecondTestError, "not a match"
|
276
279
|
end
|
277
280
|
end.must_raise SecondTestError
|
278
281
|
|
@@ -282,7 +285,7 @@ describe Retriable do
|
|
282
285
|
it "#retriable with a hash exception list where the values are exception message patterns" do
|
283
286
|
tries = 0
|
284
287
|
exceptions = []
|
285
|
-
handler =
|
288
|
+
handler = lambda do |exception, try, _elapsed_time, _next_interval|
|
286
289
|
exceptions[try] = exception
|
287
290
|
end
|
288
291
|
|
@@ -291,13 +294,13 @@ describe Retriable do
|
|
291
294
|
tries += 1
|
292
295
|
case tries
|
293
296
|
when 1
|
294
|
-
raise TestError
|
297
|
+
raise TestError, "foo"
|
295
298
|
when 2
|
296
|
-
raise TestError
|
299
|
+
raise TestError, "bar"
|
297
300
|
when 3
|
298
|
-
raise StandardError
|
301
|
+
raise StandardError
|
299
302
|
else
|
300
|
-
raise TestError
|
303
|
+
raise TestError, "crash"
|
301
304
|
end
|
302
305
|
end
|
303
306
|
end.must_raise TestError
|
@@ -324,7 +327,7 @@ describe Retriable do
|
|
324
327
|
expect do
|
325
328
|
retriable do
|
326
329
|
tries += 1
|
327
|
-
raise StandardError
|
330
|
+
raise StandardError
|
328
331
|
end
|
329
332
|
end.must_raise StandardError
|
330
333
|
|
@@ -342,7 +345,7 @@ describe Retriable do
|
|
342
345
|
tries = 0
|
343
346
|
time_table = {}
|
344
347
|
|
345
|
-
handler =
|
348
|
+
handler = lambda do |_exception, try, elapsed_time, _next_interval|
|
346
349
|
time_table[try] = elapsed_time
|
347
350
|
end
|
348
351
|
|
@@ -355,7 +358,7 @@ describe Retriable do
|
|
355
358
|
on_retry: handler,
|
356
359
|
) do
|
357
360
|
tries += 1
|
358
|
-
raise EOFError
|
361
|
+
raise EOFError
|
359
362
|
end
|
360
363
|
end.must_raise EOFError
|
361
364
|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: retriable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Chu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,11 +94,9 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.1'
|
97
|
-
description:
|
97
|
+
description: Retriable is an simple DSL to retry failed code blocks with randomized
|
98
98
|
exponential backoff. This is especially useful when interacting external api/services
|
99
99
|
or file system calls.
|
100
|
-
|
101
|
-
'
|
102
100
|
email:
|
103
101
|
- jack@jackchu.com
|
104
102
|
executables: []
|
@@ -106,6 +104,7 @@ extensions: []
|
|
106
104
|
extra_rdoc_files: []
|
107
105
|
files:
|
108
106
|
- ".gitignore"
|
107
|
+
- ".rubocop.yml"
|
109
108
|
- ".travis.yml"
|
110
109
|
- CHANGELOG.md
|
111
110
|
- Gemfile
|
@@ -123,7 +122,6 @@ files:
|
|
123
122
|
- spec/exponential_backoff_spec.rb
|
124
123
|
- spec/retriable_spec.rb
|
125
124
|
- spec/spec_helper.rb
|
126
|
-
- wercker.yml
|
127
125
|
homepage: http://github.com/kamui/retriable
|
128
126
|
licenses:
|
129
127
|
- MIT
|
@@ -144,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
142
|
version: '0'
|
145
143
|
requirements: []
|
146
144
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.6.8
|
148
146
|
signing_key:
|
149
147
|
specification_version: 4
|
150
148
|
summary: Retriable is an simple DSL to retry failed code blocks with randomized exponential
|
data/wercker.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
box: wercker/rvm
|
2
|
-
# Build definition
|
3
|
-
build:
|
4
|
-
# The steps that will be executed on build
|
5
|
-
# See the Ruby section on the wercker devcenter:
|
6
|
-
# http://devcenter.wercker.com/articles/languages/ruby.html
|
7
|
-
steps:
|
8
|
-
# Uncomment this to force RVM to use a specific Ruby version
|
9
|
-
- rvm-use:
|
10
|
-
version: 2.3.1
|
11
|
-
|
12
|
-
# A step that executes `bundle install` command
|
13
|
-
- bundle-install
|
14
|
-
|
15
|
-
# A custom script step, name value is used in the UI
|
16
|
-
# and the code value contains the command that get executed
|
17
|
-
- script:
|
18
|
-
name: echo ruby information
|
19
|
-
code: |
|
20
|
-
echo "ruby version $(ruby --version) running"
|
21
|
-
echo "from location $(which ruby)"
|
22
|
-
echo -p "gem list: $(gem list)"
|
23
|
-
|
24
|
-
# Add more steps here:
|
25
|
-
- script:
|
26
|
-
name: rake
|
27
|
-
code: bundle exec rake
|