Module: Semian::DualCircuitBreaker::SiblingSync
- Included in:
- ChildAdaptiveCircuitBreaker, ChildClassicCircuitBreaker
- Defined in:
- lib/semian/dual_circuit_breaker.rb
Overview
Module to synchronize mark_success and mark_failed calls between sibling circuit breakers and reduce code duplication
Instance Attribute Summary collapse
-
#sibling ⇒ Object
writeonly
Sets the attribute sibling.
Instance Method Summary collapse
- #mark_failed(error, scope: nil, adapter: nil) ⇒ Object
- #mark_success(scope: nil, adapter: nil) ⇒ Object
Instance Attribute Details
#sibling=(value) ⇒ Object (writeonly)
Sets the attribute sibling
12 13 14 |
# File 'lib/semian/dual_circuit_breaker.rb', line 12 def sibling=(value) @sibling = value end |
Instance Method Details
#mark_failed(error, scope: nil, adapter: nil) ⇒ Object
19 20 21 22 |
# File 'lib/semian/dual_circuit_breaker.rb', line 19 def mark_failed(error, scope: nil, adapter: nil) super @sibling.method(:mark_failed).super_method.call(error, scope:, adapter:) end |
#mark_success(scope: nil, adapter: nil) ⇒ Object
14 15 16 17 |
# File 'lib/semian/dual_circuit_breaker.rb', line 14 def mark_success(scope: nil, adapter: nil) super @sibling.method(:mark_success).super_method.call(scope:, adapter:) end |