exp_retry 0.0.5 → 0.0.6
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/Gemfile.lock +1 -1
- data/Readme.md +7 -1
- data/exp-retry.gemspec +2 -2
- data/lib/exp_retry.rb +1 -1
- data/spec/lib/exp_retry_spec.rb +14 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9a67f6691d7126ba501edd65c737d0c36b61f5a
|
4
|
+
data.tar.gz: 9fd3fe808617aef3552fdf7d8260732ca8ba6f1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61e93492bf4012340f8296783019558cbd4f61548d3cb391155d136c16f0c83977c41b0bef8d748408766ab514ca7f2fa963ae85a1c153413ea1159029da4b34
|
7
|
+
data.tar.gz: 8e727338581795bd32cbdd6befb9e0199d6dacb202277c6742fd3cec4291fa407d2e40d76d04236bff9d249521fc115e9a67362e53b705f0becb611f6046fcf8
|
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Exponential Retry
|
2
2
|
|
3
|
+
[](https://rubygems.org/gems/exp_retry)
|
3
4
|
[](https://travis-ci.org/jfiander/exp-retry)
|
4
5
|
[](https://codeclimate.com/github/jfiander/exp-retry/maintainability)
|
5
6
|
[](https://codeclimate.com/github/jfiander/exp-retry/test_coverage)
|
@@ -30,13 +31,18 @@ ExpRetry.new.call do
|
|
30
31
|
end
|
31
32
|
```
|
32
33
|
|
33
|
-
You can specify which exception class to allow retries for:
|
34
|
+
You can specify which exception class(es) to allow retries for:
|
34
35
|
|
35
36
|
```ruby
|
36
37
|
ExpRetry.new(exception: SpecificError).call do
|
37
38
|
something_generic # errors will surface immediately
|
38
39
|
something_specific # errors will trigger retries
|
39
40
|
end
|
41
|
+
|
42
|
+
ExpRetry.new(exception: [SpecificError, AnotherError]).call do
|
43
|
+
something_generic # errors will surface immediately
|
44
|
+
something_specific # errors will trigger retries
|
45
|
+
end
|
40
46
|
```
|
41
47
|
|
42
48
|
You can specify how many retries to allow:
|
data/exp-retry.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'exp_retry'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '2018-10-
|
3
|
+
s.version = '0.0.6'
|
4
|
+
s.date = '2018-10-17'
|
5
5
|
s.summary = 'Exponential backoff retry'
|
6
6
|
s.description = 'A simple exponential backoff retry wrapper.'
|
7
7
|
s.homepage = 'http://rubygems.org/gems/exp_retry'
|
data/lib/exp_retry.rb
CHANGED
data/spec/lib/exp_retry_spec.rb
CHANGED
@@ -11,7 +11,7 @@ RSpec.describe ExpRetry do
|
|
11
11
|
expect(r).to eql('Something')
|
12
12
|
end
|
13
13
|
|
14
|
-
it 'should allow normal execution' do
|
14
|
+
it 'should allow normal execution with a single failure' do
|
15
15
|
@fail_once = true
|
16
16
|
r = ExpRetry.new.call do
|
17
17
|
if @fail_once
|
@@ -24,6 +24,19 @@ RSpec.describe ExpRetry do
|
|
24
24
|
expect(r).to eql('Something')
|
25
25
|
end
|
26
26
|
|
27
|
+
it 'should allow normal execution with multiple exceptions' do
|
28
|
+
@fail_once = true
|
29
|
+
r = ExpRetry.new(exception: [RuntimeError, ArgumentError]).call do
|
30
|
+
if @fail_once
|
31
|
+
@fail_once = false
|
32
|
+
raise 'Fail once again'
|
33
|
+
end
|
34
|
+
'Something'
|
35
|
+
end
|
36
|
+
|
37
|
+
expect(r).to eql('Something')
|
38
|
+
end
|
39
|
+
|
27
40
|
it 'should raise after too many retries' do
|
28
41
|
expect do
|
29
42
|
ExpRetry.new.call { raise 'Fail forever' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exp_retry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Fiander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.6.
|
111
|
+
rubygems_version: 2.6.11
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Exponential backoff retry
|