Module: ResilientCall::CircuitBreaker

Defined in:
lib/resilient_call/circuit_breaker.rb

Overview

Global, thread-safe registry of named Circuit instances.

Class Method Summary collapse

Class Method Details

.[](name) ⇒ Object

Returns the circuit for ‘name`, creating it on first access. Created with the scope-3 defaults (threshold: 5, reset_timeout: 60); scope 4 will inject configured values through the entry point.



12
13
14
# File 'lib/resilient_call/circuit_breaker.rb', line 12

def self.[](name)
  @mutex.synchronize { @registry[name] ||= Circuit.new(name) }
end

.reset_all!Object



16
17
18
# File 'lib/resilient_call/circuit_breaker.rb', line 16

def self.reset_all!
  @mutex.synchronize { @registry.each_value(&:reset!) }
end