/// <summary> /// On entering this state, schedule an attempted reset and store the entry time to /// calculate remaining time before attempted reset. /// </summary> protected override void EnterInternal( ) { Task.Delay(_breaker.ResetTimeout).ContinueWith(task => _breaker.AttemptReset( )); }
/// <summary> /// On entering this state, schedule an attempted reset via <see cref="Actor.IScheduler"/> and store the entry time to /// calculate remaining time before attempted reset. /// </summary> protected override void EnterInternal() { GetAndSet(DateTime.UtcNow.Ticks); _breaker.Scheduler.Advanced.ScheduleOnce(_breaker.CurrentResetTimeout, () => _breaker.AttemptReset()); var nextResetTimeout = TimeSpan.FromTicks(_breaker.CurrentResetTimeout.Ticks * (long)_breaker.ExponentialBackoffFactor); if (nextResetTimeout < _breaker.MaxResetTimeout) { _breaker.SwapStateResetTimeout(_breaker.CurrentResetTimeout, nextResetTimeout); } }