/// <summary> /// Builds a <see cref="Policy" /> that will retry once /// calling <paramref name="onRetry" /> on retry with the raised exception and retry count. /// </summary> /// <param name="policyBuilder">The policy builder.</param> /// <param name="onRetry">The action to call on each retry.</param> /// <returns>The policy instance.</returns> /// <exception cref="System.ArgumentNullException">onRetry</exception> public static RetryPolicy RetryAsync(this PolicyBuilder policyBuilder, Action <Exception, int> onRetry) { return(policyBuilder.RetryAsync(1, onRetry)); }
/// <summary> /// Builds a <see cref="Policy"/> that will retry once. /// </summary> /// <param name="policyBuilder">The policy builder.</param> /// <returns>The policy instance.</returns> public static RetryPolicy RetryAsync(this PolicyBuilder policyBuilder) { return(policyBuilder.RetryAsync(1)); }
/// <summary> /// Builds a <see cref="Policy" /> that will retry <paramref name="retryCount" /> times. /// </summary> /// <param name="policyBuilder">The policy builder.</param> /// <param name="retryCount">The retry count.</param> /// <returns>The policy instance.</returns> public static RetryPolicy RetryAsync(this PolicyBuilder policyBuilder, int retryCount) { Action <Exception, int> doNothing = (_, __) => { }; return(policyBuilder.RetryAsync(retryCount, doNothing)); }
/// <summary> /// Builds a <see cref="Policy" /> that will retry once /// calling <paramref name="onRetryAsync" /> on retry with the raised exception and retry count. /// </summary> /// <param name="policyBuilder">The policy builder.</param> /// <param name="onRetryAsync">The action to call asynchronously on each retry.</param> /// <returns>The policy instance.</returns> /// <exception cref="System.ArgumentNullException">onRetry</exception> public static RetryPolicy RetryAsync(this PolicyBuilder policyBuilder, Func <Exception, int, Task> onRetryAsync) { return(policyBuilder.RetryAsync(1, onRetryAsync)); }