private TimeSpan NextRetryDelayOrThrowIfNotValid() { var nextRetryDelay = retryStrategy.NextRetryDelay(context); if (nextRetryDelay < TimeSpan.Zero) { throw new InvalidRetryDelayException(); } return(nextRetryDelay); }
public CompletionState Run() { var completionState = CompletionState.Failed; while (ShouldRetry()) { if (toRetry()) { completionState = CompletionState.Success; break; } if (ShouldRetry()) { Thread.Sleep(retryStrategy.NextRetryDelay(context)); } context.Update(); } return(completionState); }