public override void OnActionSuccess(Context context) { using (TimedLock.Lock(_lock)) { if (_circuitState == CircuitState.HalfOpen) { OnCircuitReset(context); } _metrics.IncrementSuccess_NeedsLock(); } }
public override void OnActionSuccess(Context context) { using (TimedLock.Lock(_lock)) { switch (_circuitState) { case CircuitState.HalfOpen: OnCircuitReset(context); break; case CircuitState.Closed: break; case CircuitState.Open: case CircuitState.Isolated: break; // A successful call result may arrive when the circuit is open, if it was placed before the circuit broke. We take no special action; only time passing governs transitioning from Open to HalfOpen state. default: throw new InvalidOperationException("Unhandled CircuitState."); } _metrics.IncrementSuccess_NeedsLock(); } }