AsyncExecutorWithRetries.ExecuteWithRetries Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ExecuteWithRetries(Func<Int32,Task>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider) |
Execute a given function a number of times, based on retry configuration parameters. |
ExecuteWithRetries<T>(Func<Int32,Task<T>>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider) |
Execute a given function a number of times, based on retry configuration parameters. |
ExecuteWithRetries<T>(Func<Int32,Task<T>>, Int32, Int32, Func<T, Int32,Boolean>, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider, IBackoffProvider) |
Execute a given |
ExecuteWithRetries(Func<Int32,Task>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider)
- Source:
- AsyncExecutorWithRetries.cs
Execute a given function a number of times, based on retry configuration parameters.
public static System.Threading.Tasks.Task ExecuteWithRetries (Func<int,System.Threading.Tasks.Task> action, int maxNumErrorTries, Func<Exception,int,bool> retryExceptionFilter, TimeSpan maxExecutionTime, Orleans.Internal.IBackoffProvider onErrorBackOff);
static member ExecuteWithRetries : Func<int, System.Threading.Tasks.Task> * int * Func<Exception, int, bool> * TimeSpan * Orleans.Internal.IBackoffProvider -> System.Threading.Tasks.Task
Public Shared Function ExecuteWithRetries (action As Func(Of Integer, Task), maxNumErrorTries As Integer, retryExceptionFilter As Func(Of Exception, Integer, Boolean), maxExecutionTime As TimeSpan, onErrorBackOff As IBackoffProvider) As Task
Parameters
- maxNumErrorTries
- Int32
The maximum number of retries.
- maxExecutionTime
- TimeSpan
The maximum execution time.
- onErrorBackOff
- IBackoffProvider
The backoff provider.
Returns
A Task representing the operation.
Applies to
ExecuteWithRetries<T>(Func<Int32,Task<T>>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider)
- Source:
- AsyncExecutorWithRetries.cs
Execute a given function a number of times, based on retry configuration parameters.
public static System.Threading.Tasks.Task<T> ExecuteWithRetries<T> (Func<int,System.Threading.Tasks.Task<T>> function, int maxNumErrorTries, Func<Exception,int,bool> retryExceptionFilter, TimeSpan maxExecutionTime, Orleans.Internal.IBackoffProvider onErrorBackOff);
static member ExecuteWithRetries : Func<int, System.Threading.Tasks.Task<'T>> * int * Func<Exception, int, bool> * TimeSpan * Orleans.Internal.IBackoffProvider -> System.Threading.Tasks.Task<'T>
Public Shared Function ExecuteWithRetries(Of T) (function As Func(Of Integer, Task(Of T)), maxNumErrorTries As Integer, retryExceptionFilter As Func(Of Exception, Integer, Boolean), maxExecutionTime As TimeSpan, onErrorBackOff As IBackoffProvider) As Task(Of T)
Type Parameters
- T
Parameters
- maxNumErrorTries
- Int32
The maximum number of retries.
- maxExecutionTime
- TimeSpan
The maximum execution time.
- onErrorBackOff
- IBackoffProvider
The backoff provider.
Returns
The value returned from the successful invocation of the provided function.
Applies to
ExecuteWithRetries<T>(Func<Int32,Task<T>>, Int32, Int32, Func<T, Int32,Boolean>, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider, IBackoffProvider)
- Source:
- AsyncExecutorWithRetries.cs
Execute a given function
a number of times, based on retry configuration parameters.
public static System.Threading.Tasks.Task<T> ExecuteWithRetries<T> (Func<int,System.Threading.Tasks.Task<T>> function, int maxNumSuccessTries, int maxNumErrorTries, Func<T,int,bool> retryValueFilter, Func<Exception,int,bool> retryExceptionFilter, TimeSpan maxExecutionTime = default, Orleans.Internal.IBackoffProvider onSuccessBackOff = default, Orleans.Internal.IBackoffProvider onErrorBackOff = default);
static member ExecuteWithRetries : Func<int, System.Threading.Tasks.Task<'T>> * int * int * Func<'T, int, bool> * Func<Exception, int, bool> * TimeSpan * Orleans.Internal.IBackoffProvider * Orleans.Internal.IBackoffProvider -> System.Threading.Tasks.Task<'T>
Public Shared Function ExecuteWithRetries(Of T) (function As Func(Of Integer, Task(Of T)), maxNumSuccessTries As Integer, maxNumErrorTries As Integer, retryValueFilter As Func(Of T, Integer, Boolean), retryExceptionFilter As Func(Of Exception, Integer, Boolean), Optional maxExecutionTime As TimeSpan = Nothing, Optional onSuccessBackOff As IBackoffProvider = Nothing, Optional onErrorBackOff As IBackoffProvider = Nothing) As Task(Of T)
Type Parameters
- T
The underlying return type of function
.
Parameters
- maxNumSuccessTries
- Int32
Maximal number of successful execution attempts. ExecuteWithRetries(Func<Int32,Task>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider) will try to re-execute the given function
again if directed so by retryValueFilter
.
Set to -1
for unlimited number of success retries, until retryValueFilter
is satisfied. Set to 0
for only one success attempt, which will cause retryValueFilter
to be
ignored and the given function
executed only once until first success.
- maxNumErrorTries
- Int32
Maximal number of execution attempts due to errors. Set to -1 for unlimited number of error retries, until retryExceptionFilter
is satisfied.
Filter function
to indicate if successful execution should be retried. Set to null
to disable successful retries.
Filter function
to indicate if error execution should be retried. Set to null
to disable error retries.
- maxExecutionTime
- TimeSpan
The maximal execution time of the ExecuteWithRetries(Func<Int32,Task>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider) function.
- onSuccessBackOff
- IBackoffProvider
The backoff provider object, which determines how much to wait between success retries.
- onErrorBackOff
- IBackoffProvider
The backoff provider object, which determines how much to wait between error retries
Returns
The value returned from the successful invocation of function
.