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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da5c2a13c348c150f58bedf40fc788b4df1c973f
4
- data.tar.gz: 536aea32f77ce1987400e24f077dfaab68cea6a3
3
+ metadata.gz: a9a67f6691d7126ba501edd65c737d0c36b61f5a
4
+ data.tar.gz: 9fd3fe808617aef3552fdf7d8260732ca8ba6f1c
5
5
  SHA512:
6
- metadata.gz: 3a569f468519378ecdfdac88288d780762f7a4e8fc82c1fa69d6bfe1f60d288ced8de850a9a908989d67954e33903f40d92d211a74542139083c1198bb99b5b5
7
- data.tar.gz: 56235d4ec13d07245bebee28f896b84a94828957c0e79c7d2119603c60febe199abb7c871f4e10654bf1570b75be7352e0b7a70344246b8638e61b4c86b72442
6
+ metadata.gz: 61e93492bf4012340f8296783019558cbd4f61548d3cb391155d136c16f0c83977c41b0bef8d748408766ab514ca7f2fa963ae85a1c153413ea1159029da4b34
7
+ data.tar.gz: 8e727338581795bd32cbdd6befb9e0199d6dacb202277c6742fd3cec4291fa407d2e40d76d04236bff9d249521fc115e9a67362e53b705f0becb611f6046fcf8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exp_retry (0.0.5)
4
+ exp_retry (0.0.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/Readme.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Exponential Retry
2
2
 
3
+ [![Gem Version](https://img.shields.io/gem/v/exp_retry.svg)](https://rubygems.org/gems/exp_retry)
3
4
  [![Build Status](https://travis-ci.org/jfiander/exp-retry.svg)](https://travis-ci.org/jfiander/exp-retry)
4
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/4c8be06f11872994f2c7/maintainability)](https://codeclimate.com/github/jfiander/exp-retry/maintainability)
5
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/4c8be06f11872994f2c7/test_coverage)](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.5'
4
- s.date = '2018-10-16'
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
@@ -9,7 +9,7 @@ class ExpRetry
9
9
 
10
10
  def call
11
11
  yield if block_given?
12
- rescue @exception => e
12
+ rescue *@exception => e
13
13
  check(e)
14
14
  retry
15
15
  end
@@ -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.5
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-16 00:00:00.000000000 Z
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.6
111
+ rubygems_version: 2.6.11
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Exponential backoff retry