-
Notifications
You must be signed in to change notification settings - Fork 16
Retry
ZjzMisaka edited this page Feb 19, 2025
·
4 revisions
After setting WorkOption.RetryOption, if a work throws an exception and fails to execute, it will be retried according to the settings.
You can configure the retry behavior (immediate retry or requeue), set the number of retries, or allow for unlimited retries (properties to stop retrying are provided in both callback and WorkEnded event parameters).
powerPool.QueueWorkItem(() =>
{
throw new Exception();
}, new WorkOption<object>()
{
RetryOption = new RetryOption()
{
RetryBehavior = RetryBehavior.Requeue,
RetryPolicy = RetryPolicy.Limited,
MaxRetryCount = 5,
},
Callback = (res) =>
{
if (res.Status == Status.Failed)
{
if (res.RetryInfo.CurrentRetryCount == 2)
{
res.RetryInfo.StopRetry = true;
}
}
}
});- Sync | Async
- Pool Control | Work Control
- Divide And Conquer
- Thread Pool Sizing
- Work Callback | Default Callback
- Rejection Policy
- Parallel Execution
- Work Priority | Thread Priority
- Error Handling
- Work Timeout | Cumulative Work Timeout
- Work Dependency
- Work Group
- Events
- Runtime Status
- Running Timer
- Queue Type (FIFO | LIFO | Custom | Deque)
- Load Balancing
- Low-Contention Design
Core
Results
Options