Пример #1
0
 /// <summary>
 /// Perform an synchronous retry up to the maximum specified limit
 /// </summary>
 /// <param name="action"></param>
 /// <param name="retryInterval">How often to perform the retry.</param>
 /// <param name="retryLimit">The maximum number of times to retry</param>
 /// <param name="retryPolicy">The retry policy to apply</param>
 /// <param name="retryPolicyOptions">Options to specify further configuration for a retry policy</param>
 /// <exception cref="RetryTimeoutException"></exception>
 public static void Do(RetryActionWithParameters action, TimeSpan retryInterval, int retryLimit, RetryPolicy retryPolicy, RetryPolicyOptions retryPolicyOptions)
 => Do(action, retryInterval, retryLimit, retryPolicy, retryPolicyOptions, null, null);
Пример #2
0
 /// <summary>
 /// Perform a synchronous retry up to the maximum specified limit
 /// </summary>
 /// <param name="action">The Action to call that will be retried until successful.</param>
 /// <param name="retryInterval">How often to perform the retry.</param>
 /// <param name="retryLimit">The maximum number of times to retry</param>
 /// <param name="onFailure">Will be called upon an exception thrown</param>
 /// <param name="mustReturnTrueBeforeFail">Must evaluate to true for retry to fail. Evaluating to false will retry infinitely until true.</param>
 /// <param name="retryPolicy">The retry policy to apply</param>
 /// <param name="retryPolicyOptions">The options to provide your retry policy</param>
 /// <param name="exceptionTypes">A list of exceptions that will be retried gracefully. All other exceptions will be rethrown.</param>
 /// <exception cref="RetryTimeoutException"></exception>
 public static void Do(RetryActionWithParameters action, TimeSpan retryInterval, int retryLimit, RetryPolicy retryPolicy, RetryPolicyOptions retryPolicyOptions, Action <Exception, int, int> onFailure, Func <bool> mustReturnTrueBeforeFail, params Type[] exceptionTypes)
 => PerformAction <object>((x, y) => { action.Invoke(x, y); return(null); }, retryInterval, retryLimit, retryPolicy, retryPolicyOptions, onFailure, mustReturnTrueBeforeFail, exceptionTypes);
Пример #3
0
 /// <summary>
 /// Perform an synchronous retry up to the maximum specified limit
 /// </summary>
 /// <param name="action"></param>
 /// <param name="retryInterval">How often to perform the retry.</param>
 /// <param name="retryLimit">The maximum number of times to retry</param>
 /// <param name="exceptionTypes">A list of exceptions that will be retried gracefully. All other exceptions will be rethrown.</param>
 /// <exception cref="RetryTimeoutException"></exception>
 public static void Do(RetryActionWithParameters action, TimeSpan retryInterval, int retryLimit, params Type[] exceptionTypes)
 => Do(action, retryInterval, retryLimit, RetryPolicy.StaticDelay, RetryPolicyOptions.None, null, null, exceptionTypes);
Пример #4
0
 /// <summary>
 /// Perform an synchronous retry up to the maximum specified limit
 /// </summary>
 /// <param name="action"></param>
 /// <param name="exceptionTypes">A list of exceptions that will be retried gracefully. All other exceptions will be rethrown.</param>
 /// <exception cref="RetryTimeoutException"></exception>
 public static void Do(RetryActionWithParameters action, params Type[] exceptionTypes)
 => Do(action, DefaultRetryInterval, DefaultRetryLimit, RetryPolicy.StaticDelay, RetryPolicyOptions.None, null, null, exceptionTypes);
Пример #5
0
 /// <summary>
 /// Perform an synchronous retry up to the maximum specified limit
 /// </summary>
 /// <param name="action"></param>
 /// <param name="retryInterval">How often to perform the retry.</param>
 /// <param name="retryLimit">The maximum number of times to retry</param>
 /// <param name="onFailure">Will be called upon an exception thrown</param>
 /// <exception cref="RetryTimeoutException"></exception>
 public static void Do(RetryActionWithParameters action, TimeSpan retryInterval, int retryLimit, Action <Exception, int, int> onFailure)
 => Do(action, retryInterval, retryLimit, RetryPolicy.StaticDelay, RetryPolicyOptions.None, onFailure, null);
Пример #6
0
 /// <summary>
 /// Perform an synchronous retry up to the maximum specified limit
 /// </summary>
 /// <param name="action"></param>
 /// <param name="retryLimit">The maximum number of times to retry</param>
 /// <exception cref="RetryTimeoutException"></exception>
 public static void Do(RetryActionWithParameters action, int retryLimit)
 => Do(action, DefaultRetryInterval, retryLimit, RetryPolicy.StaticDelay, RetryPolicyOptions.None, null, null);
Пример #7
0
 /// <summary>
 /// Perform an synchronous retry up to the maximum specified limit
 /// </summary>
 /// <param name="action"></param>
 /// <exception cref="RetryTimeoutException"></exception>
 public static void Do(RetryActionWithParameters action)
 => Do(action, TimeSpan.FromSeconds(1), DefaultRetryLimit, RetryPolicy.StaticDelay, RetryPolicyOptions.None, null, null);