共用方式為


AsyncExecutorWithRetries.ExecuteWithRetries 方法

定義

多載

ExecuteWithRetries(Func<Int32,Task>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider)

根據重試組態參數執行指定函式的次數。

ExecuteWithRetries<T>(Func<Int32,Task<T>>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider)

根據重試組態參數執行指定函式的次數。

ExecuteWithRetries<T>(Func<Int32,Task<T>>, Int32, Int32, Func<T, Int32,Boolean>, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider, IBackoffProvider)

根據重試組態參數,執行指定的 function 次數。

ExecuteWithRetries(Func<Int32,Task>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider)

來源:
AsyncExecutorWithRetries.cs

根據重試組態參數執行指定函式的次數。

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

參數

action
Func<Int32,Task>

要執行的動作。

maxNumErrorTries
Int32

重試次數上限。

retryExceptionFilter
Func<Exception,Int32,Boolean>

重試例外狀況篩選準則。

maxExecutionTime
TimeSpan

最大執行時間。

onErrorBackOff
IBackoffProvider

輪詢提供者。

傳回

Task 表示作業。

適用於

ExecuteWithRetries<T>(Func<Int32,Task<T>>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider)

來源:
AsyncExecutorWithRetries.cs

根據重試組態參數執行指定函式的次數。

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)

類型參數

T

參數

function
Func<Int32,Task<T>>

要執行的委派。

maxNumErrorTries
Int32

重試次數上限。

retryExceptionFilter
Func<Exception,Int32,Boolean>

重試例外狀況篩選準則。

maxExecutionTime
TimeSpan

最大執行時間。

onErrorBackOff
IBackoffProvider

輪詢提供者。

傳回

Task<T>

從所提供函式成功調用傳回的值。

適用於

ExecuteWithRetries<T>(Func<Int32,Task<T>>, Int32, Int32, Func<T, Int32,Boolean>, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider, IBackoffProvider)

來源:
AsyncExecutorWithRetries.cs

根據重試組態參數,執行指定的 function 次數。

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)

類型參數

T

的基礎傳回型 function 別。

參數

function
Func<Int32,Task<T>>

要執行的函式

maxNumSuccessTries
Int32

成功執行嘗試的最大數目。 ExecuteWithRetries(Func<Int32,Task>, Int32, Func<Exception,Int32,Boolean>, TimeSpan, IBackoffProvider)如果由 retryValueFilter 指示,則會嘗試重新執行指定的 function 。 設定為 -1 ,直到滿足為止, retryValueFilter 以取得無限制的成功重試次數。 僅針對一次成功嘗試設定為 0 ,這會導致 retryValueFilter 忽略,而且指定的 function 只會執行一次,直到第一次成功為止。

maxNumErrorTries
Int32

因錯誤而嘗試執行的最大次數。 針對不限數目的錯誤重試,設定為 -1,直到 retryExceptionFilter 滿足為止。

retryValueFilter
Func<T,Int32,Boolean>

篩選 function 以指出是否應該重試成功執行。 設定為 null 以停用成功的重試。

retryExceptionFilter
Func<Exception,Int32,Boolean>

篩選 function 以指出是否應該重試錯誤執行。 設定為 null 以停用錯誤重試。

onSuccessBackOff
IBackoffProvider

輪詢提供者物件,決定成功重試之間要等候多少。

onErrorBackOff
IBackoffProvider

輪詢提供者物件,決定在錯誤重試之間等候多少

傳回

Task<T>

從 成功叫用 function 傳回的值。

適用於