Пример #1
0
 private void SetFailureCount(RestartStatistics rs)
 {
     // if we are within the backoff window, exit early
     if (rs.IsWithinDuration(_backoffWindow))
     {
         rs.Fail();
         return;
     }
     //we are past the backoff limit, reset the failure counter
     rs.Reset();
 }
Пример #2
0
 private bool RequestRestartPermission(RestartStatistics rs)
 {
     if (_maxNrOfRetries == 0)
     {
         return(false);
     }
     rs.Fail();
     if (_withinTimeSpan == null || rs.IsWithinDuration(_withinTimeSpan.Value))
     {
         return(rs.FailureCount <= _maxNrOfRetries);
     }
     rs.Reset();
     return(true);
 }