Module: BreakerMachines::Circuit::CoordinatedStateManagement
- Extended by:
- ActiveSupport::Concern
- Included in:
- BreakerMachines::CoordinatedCircuit
- Defined in:
- lib/breaker_machines/circuit/coordinated_state_management.rb
Overview
CoordinatedStateManagement extends the base state machine with coordinated guards that allow circuits to make transitions based on the state of other circuits.
Instance Method Summary collapse
-
#recovery_allowed? ⇒ Boolean
Check if this circuit can attempt recovery For cascading circuits, this checks if dependent circuits allow it.
-
#reset_allowed? ⇒ Boolean
Check if this circuit can reset to closed For cascading circuits, ensures dependencies are healthy.
Instance Method Details
#recovery_allowed? ⇒ Boolean
Check if this circuit can attempt recovery For cascading circuits, this checks if dependent circuits allow it
63 64 65 66 67 68 |
# File 'lib/breaker_machines/circuit/coordinated_state_management.rb', line 63 def recovery_allowed? return true unless respond_to?(:dependent_circuits) && dependent_circuits.any? # Don't attempt recovery if any critical dependencies are still down !has_critical_dependencies_down? end |
#reset_allowed? ⇒ Boolean
Check if this circuit can reset to closed For cascading circuits, ensures dependencies are healthy
72 73 74 75 76 77 |
# File 'lib/breaker_machines/circuit/coordinated_state_management.rb', line 72 def reset_allowed? return true unless respond_to?(:dependent_circuits) && dependent_circuits.any? # Only reset if all dependencies are in acceptable states all_dependencies_healthy? end |