/// <summary> /// Initializes a new instance of the <see cref="ExponentialRetry"/> class using the specified delta and maximum number of retries. /// </summary> /// <param name="deltaBackoff">The backoff interval between retries, where the resulting backoff is 2^n * deltaBackoff (where n is the number of retries)</param> /// <param name="maxRetries">The maximum number of retry attempts.</param> public ExponentialRetry(TimeSpan deltaBackoff, int maxRetries) { RetryPolicyCommon.ValidateArguments(deltaBackoff, maxRetries); this.DeltaBackoff = deltaBackoff; this.MaximumRetries = maxRetries; }
/// <summary> /// Initializes a new instance of the <see cref="ExponentialRetry"/> class using the specified delta and maximum number of retries. /// </summary> /// <param name="deltaBackoff">The backoff interval between retries, where the resulting backoff is 2^n * deltaBackoff (where n is the number of retries)</param> /// <param name="maxRetries">The maximum number of retry attempts.</param> /// <param name="maxBackoff">The maximum duration to wait between retries.</param> public ExponentialRetry(TimeSpan deltaBackoff, int maxRetries, TimeSpan?maxBackoff = null) { RetryPolicyCommon.ValidateArguments(deltaBackoff, maxRetries); if (maxBackoff < TimeSpan.Zero) { throw new ArgumentOutOfRangeException(nameof(maxBackoff)); } this.DeltaBackoff = deltaBackoff; this.MaximumRetries = maxRetries; this.MaxBackoff = maxBackoff; }