exp_retry 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Readme.md +16 -2
- data/exp-retry.gemspec +2 -2
- data/spec/lib/exp_retry_spec.rb +3 -3
- 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: da5c2a13c348c150f58bedf40fc788b4df1c973f
|
4
|
+
data.tar.gz: 536aea32f77ce1987400e24f077dfaab68cea6a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a569f468519378ecdfdac88288d780762f7a4e8fc82c1fa69d6bfe1f60d288ced8de850a9a908989d67954e33903f40d92d211a74542139083c1198bb99b5b5
|
7
|
+
data.tar.gz: 56235d4ec13d07245bebee28f896b84a94828957c0e79c7d2119603c60febe199abb7c871f4e10654bf1570b75be7352e0b7a70344246b8638e61b4c86b72442
|
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -6,6 +6,20 @@
|
|
6
6
|
|
7
7
|
A simple exponential backoff retry wrapper.
|
8
8
|
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this to your Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'exp_retry'
|
15
|
+
```
|
16
|
+
|
17
|
+
Or manually install the gem:
|
18
|
+
|
19
|
+
```sh
|
20
|
+
gem install exp_retry
|
21
|
+
```
|
22
|
+
|
9
23
|
## Usage
|
10
24
|
|
11
25
|
You can wrap a simple block to enable retries:
|
@@ -19,7 +33,7 @@ end
|
|
19
33
|
You can specify which exception class to allow retries for:
|
20
34
|
|
21
35
|
```ruby
|
22
|
-
ExpRetry.new
|
36
|
+
ExpRetry.new(exception: SpecificError).call do
|
23
37
|
something_generic # errors will surface immediately
|
24
38
|
something_specific # errors will trigger retries
|
25
39
|
end
|
@@ -28,7 +42,7 @@ end
|
|
28
42
|
You can specify how many retries to allow:
|
29
43
|
|
30
44
|
```ruby
|
31
|
-
ExpRetry.new
|
45
|
+
ExpRetry.new(retries: 5).call do
|
32
46
|
something_unreliable # will retry 5 times
|
33
47
|
end
|
34
48
|
```
|
data/exp-retry.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'exp_retry'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.5'
|
4
4
|
s.date = '2018-10-16'
|
5
5
|
s.summary = 'Exponential backoff retry'
|
6
6
|
s.description = 'A simple exponential backoff retry wrapper.'
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
14
14
|
|
15
|
-
s.required_ruby_version = '~> 2.
|
15
|
+
s.required_ruby_version = '~> 2.2'
|
16
16
|
|
17
17
|
s.add_development_dependency 'rake', '~> 12.2', '>= 12.2.1'
|
18
18
|
s.add_development_dependency 'rspec', '~> 3.7', '>= 3.7.0'
|
data/spec/lib/exp_retry_spec.rb
CHANGED
@@ -12,10 +12,10 @@ RSpec.describe ExpRetry do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should allow normal execution' do
|
15
|
-
@fail_once =
|
15
|
+
@fail_once = true
|
16
16
|
r = ExpRetry.new.call do
|
17
|
-
if @fail_once
|
18
|
-
@fail_once
|
17
|
+
if @fail_once
|
18
|
+
@fail_once = false
|
19
19
|
raise 'Fail once'
|
20
20
|
end
|
21
21
|
'Something'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Fiander
|
@@ -100,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '2.
|
103
|
+
version: '2.2'
|
104
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - ">="
|
@@ -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.6
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Exponential backoff retry
|