circuit_breakage 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/circuit_breakage/breaker.rb +10 -2
- data/lib/circuit_breakage/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d59c7f0387657741b8cdb896c9fbc9bdeb130c09
|
4
|
+
data.tar.gz: d54f9a2a8c87fbb41c6d47d17d89e8c603b28062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36fd7a9668294099a94db646b5337bfa006ac50211113a357b2c37ad6b8be0b2007264e66a342280880630dcae20df289fcbada91f729eb96b2989cd3a5fe8fd
|
7
|
+
data.tar.gz: 3624cd0493809f40458e82d64aeef20ff3d55be24063eff796ae339896ba0a0ef24c2b2b8c1c1058ef50c043ff07725405beddb673490cbfa0834d3975ff505d
|
@@ -47,7 +47,7 @@ module CircuitBreakage
|
|
47
47
|
|
48
48
|
def do_call(*args)
|
49
49
|
ret_value = nil
|
50
|
-
Timeout.timeout(self.timeout
|
50
|
+
Timeout.timeout(self.timeout) do
|
51
51
|
ret_value = @block.call(*args)
|
52
52
|
end
|
53
53
|
handle_success
|
@@ -74,7 +74,15 @@ module CircuitBreakage
|
|
74
74
|
end
|
75
75
|
|
76
76
|
self.last_exception = error
|
77
|
-
|
77
|
+
|
78
|
+
if error.instance_of?(Timeout::Error)
|
79
|
+
# Raising an instance of Interrupt seems pretty rude, and there's no
|
80
|
+
# useful information in Timeout::Error anyway, so re-raise timeout
|
81
|
+
# errors as our own error class.
|
82
|
+
raise CircuitTimeout, "Circuit breaker timed out."
|
83
|
+
else
|
84
|
+
raise(error)
|
85
|
+
end
|
78
86
|
end
|
79
87
|
end
|
80
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circuit_breakage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hyland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|