semian 0.8.0 → 0.8.1
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 +4 -4
- data/lib/semian/circuit_breaker.rb +7 -7
- data/lib/semian/simple_state.rb +1 -1
- data/lib/semian/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: 06426c58d5f63b75836c2ee4de57b5546695bdb3
|
4
|
+
data.tar.gz: cc392c302a788c6ac542d8d71dbb56fd1ffba899
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 930c8b5d1a0df10034388bd50552782edc95cf309d85dbf4759a91d20898924ca8f4eea7695ecbc2877b0ea8ca7db811380a47938ed2652cf70403f8870f9ce6
|
7
|
+
data.tar.gz: dde2cbf4a37f1fba443091c17ea7b8ff1d28f424dbb362bfcdd5b3964194bd26f29516b518652cdf78eb62bdec1a61139f3b2ed266bb40270e0dfd6924bc4344
|
@@ -2,7 +2,7 @@ module Semian
|
|
2
2
|
class CircuitBreaker #:nodoc:
|
3
3
|
extend Forwardable
|
4
4
|
|
5
|
-
def_delegators :@state, :closed?, :open?, :half_open
|
5
|
+
def_delegators :@state, :closed?, :open?, :half_open!
|
6
6
|
|
7
7
|
attr_reader :name, :half_open_resource_timeout
|
8
8
|
|
@@ -21,8 +21,7 @@ module Semian
|
|
21
21
|
|
22
22
|
def acquire(resource = nil, &block)
|
23
23
|
return yield if disabled?
|
24
|
-
|
25
|
-
half_open if open? && error_timeout_expired?
|
24
|
+
half_open! if half_open?
|
26
25
|
|
27
26
|
raise OpenCircuitError unless request_allowed?
|
28
27
|
|
@@ -38,11 +37,12 @@ module Semian
|
|
38
37
|
result
|
39
38
|
end
|
40
39
|
|
40
|
+
def half_open?
|
41
|
+
(open? && error_timeout_expired?) || @state.half_open?
|
42
|
+
end
|
43
|
+
|
41
44
|
def request_allowed?
|
42
|
-
closed? ||
|
43
|
-
half_open? ||
|
44
|
-
# The circuit breaker is officially open, but it will transition to half-open on the next attempt.
|
45
|
-
(open? && error_timeout_expired?)
|
45
|
+
closed? || half_open?
|
46
46
|
end
|
47
47
|
|
48
48
|
def mark_failed(_error)
|
data/lib/semian/simple_state.rb
CHANGED
data/lib/semian/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Francis
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake-compiler
|