Exemple #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();
 }
 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);
 }