simple_circuit_breaker 0.2.1 → 0.2.2
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 +8 -8
- data/lib/simple_circuit_breaker.rb +8 -8
- data/simple_circuit_breaker.gemspec +1 -0
- data/test/simple_circuit_breaker_test.rb +9 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDI0YTBhYjI4NTg5MDg3N2Q3N2EyNzIyOTcwNGVlZjVjNDA5NmZlYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDNhYmNkZTM4ZjI3OWQ0YmQ0OWU4YmJlNzM3ZTM1YjA5NWNjNTcwOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTQzMTViNjQ4NTg1YmE0OGE5OTBhNGUwYTYwNzMyNWIxN2FiNGY3Y2MzYmU4
|
10
|
+
N2Y5NjFlYTgyOTRkYmIwMjEwMTk4YTk0MThiYjc4ZjBmNWYxODlmZmNiMDM3
|
11
|
+
OTQ3YjUyMjUyZTUxZjAxYzIxY2UyYmZlYzVjNjM3NGJiMDU2MTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWY5ZjBjMDM4ZDA5MTk4YTY4YWFhMWM4MDVjODkzMDBmYWM0YzE5YThkMTFh
|
14
|
+
MWM1ZjEwZjYyZjUxNWI5ZmJjZTcwYjhmYTM3ZDliOTAyOTlkYjgxYTdjY2Yw
|
15
|
+
ZmUwN2JkYjMwNzlkMDg3ZjM2YjBhNDNkY2U4ZjgwZTM5ODQ3NjM=
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class SimpleCircuitBreaker
|
2
|
-
VERSION = '0.2.
|
2
|
+
VERSION = '0.2.2'
|
3
3
|
|
4
4
|
class CircuitOpenError < StandardError
|
5
5
|
end
|
@@ -23,14 +23,14 @@ class SimpleCircuitBreaker
|
|
23
23
|
protected
|
24
24
|
|
25
25
|
def execute(exceptions, &block)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
raise
|
26
|
+
result = yield
|
27
|
+
reset!
|
28
|
+
result
|
29
|
+
rescue Exception => exception
|
30
|
+
if exceptions.empty? || exceptions.include?(exception.class)
|
31
|
+
fail!
|
33
32
|
end
|
33
|
+
raise
|
34
34
|
end
|
35
35
|
|
36
36
|
def fail!
|
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ['Julius Volz', 'Tobias Schmidt']
|
10
10
|
s.email = 'julius@soundcloud.com ts@soundcloud.com'
|
11
11
|
s.homepage = 'http://github.com/soundcloud/simple_circuit_breaker'
|
12
|
+
s.licenses = ['MIT']
|
12
13
|
|
13
14
|
s.files = `git ls-files`.split("\n")
|
14
15
|
s.test_files = `git ls-files -- test/*`.split("\n")
|
@@ -32,6 +32,15 @@ describe SimpleCircuitBreaker do
|
|
32
32
|
foo.must_equal 42
|
33
33
|
end
|
34
34
|
|
35
|
+
it 'works with BasicObject return values' do
|
36
|
+
object = BasicObject.new
|
37
|
+
foo = @breaker.handle do
|
38
|
+
object
|
39
|
+
end
|
40
|
+
|
41
|
+
assert foo.equal?(object)
|
42
|
+
end
|
43
|
+
|
35
44
|
it 'opens after 3 consecutive failures with no explicit handled exceptions' do
|
36
45
|
3.times do
|
37
46
|
begin
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_circuit_breaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julius Volz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-09-21 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Simple Ruby implementation of the Circuit Breaker design pattern
|
15
15
|
email: julius@soundcloud.com ts@soundcloud.com
|
@@ -25,7 +25,8 @@ files:
|
|
25
25
|
- simple_circuit_breaker.gemspec
|
26
26
|
- test/simple_circuit_breaker_test.rb
|
27
27
|
homepage: http://github.com/soundcloud/simple_circuit_breaker
|
28
|
-
licenses:
|
28
|
+
licenses:
|
29
|
+
- MIT
|
29
30
|
metadata: {}
|
30
31
|
post_install_message:
|
31
32
|
rdoc_options: []
|