Module: ResilientCall::CircuitBreaker
- Defined in:
- lib/resilient_call/circuit_breaker.rb
Overview
Global, thread-safe registry of named Circuit instances.
Class Method Summary collapse
-
.[](name) ⇒ Object
Returns the circuit for
name, creating it on first access. - .reset_all! ⇒ Object
Class Method Details
.[](name) ⇒ Object
Returns the circuit for name, creating it on first access. Created with
default thresholds and the globally configured storage; the entry point
injects the configured thresholds through Circuit#update_config.
12 13 14 15 16 |
# File 'lib/resilient_call/circuit_breaker.rb', line 12 def self.[](name) @mutex.synchronize do @registry[name] ||= Circuit.new(name, storage: ResilientCall.configuration.circuit_storage) end end |
.reset_all! ⇒ Object
18 19 20 |
# File 'lib/resilient_call/circuit_breaker.rb', line 18 def self.reset_all! @mutex.synchronize { @registry.each_value(&:reset!) } end |