예제 #1
0
파일: RetryImpl.cs 프로젝트: apollux/Turtle
        private TimeSpan NextRetryDelayOrThrowIfNotValid()
        {
            var nextRetryDelay = retryStrategy.NextRetryDelay(context);

            if (nextRetryDelay < TimeSpan.Zero)
            {
                throw new InvalidRetryDelayException();
            }

            return(nextRetryDelay);
        }
예제 #2
0
        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);
        }