Exemplo n.º 1
0
        AddRetryInterceptor(
            StashClientOptions options)
        {
            // Get a function which creates the policy and invoke it to get the actual policy
            var exponentatial =
                RetryPolicies.GetExponential(
                    Retryable.DefaultAttempts,
                    Retryable.DefaultDeltaBackoff)();

            // create an interceptor which wraps the policy and assigns it to the option.
            options.RetryPolicy =
                () =>
                (attempt, ex) => {
                System.Diagnostics.Debug.WriteLine(
                    "Attempt = {0}. Exception = {1}",
                    attempt,
                    ex);

                return(exponentatial(attempt, ex));
            };
        }