rescue-retry 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/rescue/handler.rb +4 -4
- data/lib/rescue/version.rb +1 -1
- data/rescue-retry.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d9182769a84d432b29f0d2999cf3c62faacfe6d
|
4
|
+
data.tar.gz: 623972364f0ce7e2496d17d1cc365c39cd152ad3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4f403fa12755cbae714cae66912023a476d52e0604452d27dd1453ff0b77665d4b84ca31e02b2b40852fddc46774cb03a20e835be69bb6c6d70c7de04e15e96
|
7
|
+
data.tar.gz: 4f8ee2e17f7d1aab9e4ac235412e8d63f67ff4ae9adcc0fa3ea8e7c5a2b8e3b6394cf5752b4cb501e37222f496b86324cff6959e00f9a068ccdfa8433d67f9fd
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Rescue::Retry
|
1
|
+
# Rescue::Retry [![Build Status](https://travis-ci.org/robert2d/rescue-retry.svg?branch=master)](https://travis-ci.org/robert2d/rescue-retry) [![Coverage Status](https://coveralls.io/repos/github/robert2d/rescue-retry/badge.svg?branch=master)](https://coveralls.io/github/robert2d/rescue-retry?branch=master)
|
2
2
|
|
3
3
|
Wraps a instance method in a configurable retry handler with additional/optional delay logic as well.
|
4
4
|
|
@@ -52,5 +52,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
52
52
|
|
53
53
|
## Contributing
|
54
54
|
|
55
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
55
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/robert2d/rescue-retry.
|
56
56
|
|
data/lib/rescue/handler.rb
CHANGED
@@ -15,8 +15,8 @@ module Rescue
|
|
15
15
|
def call(&block)
|
16
16
|
block.call
|
17
17
|
rescue *errors => e
|
18
|
-
|
19
|
-
|
18
|
+
log_attempt(e)
|
19
|
+
raise if max_attempts?
|
20
20
|
@attempt += 1
|
21
21
|
sleep delay_retry(attempt) unless delay == :none
|
22
22
|
retry
|
@@ -31,9 +31,9 @@ module Rescue
|
|
31
31
|
raise ArgumentError, "unknown delay \"#{delay}\". accepts: :exponential, :linear and :random"
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def log_attempt(e)
|
35
|
+
logger.warn "Failed attempt (#{attempt} of #{max_attempts}) #<#{e.class.name}.#{e.message}>"
|
35
36
|
logger.error "maximum attempts (#{max_attempts}) reached"
|
36
|
-
raise error.class, error.message
|
37
37
|
end
|
38
38
|
|
39
39
|
def max_attempts?
|
data/lib/rescue/version.rb
CHANGED
data/rescue-retry.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rescue-retry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- robert2d
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
55
69
|
description: Wraps an instance method with retry and error capture without adding
|
56
70
|
logic directly to the method
|
57
71
|
email:
|
@@ -91,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
105
|
version: '0'
|
92
106
|
requirements: []
|
93
107
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.6.11
|
95
109
|
signing_key:
|
96
110
|
specification_version: 4
|
97
111
|
summary: Rescue and Retry a instance method, whilst keeping a method free from rescue's
|