-
Notifications
You must be signed in to change notification settings - Fork 5
Retry
ZjzMisaka edited this page Apr 19, 2024
·
3 revisions
After setting WorkOption.RetryOption, if a task 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;
}
}
}
});
- Pool Control | Work Control
- Thread Pool Sizing
- Work Callback | Default Callback
- 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)
- Load Balancing
- Lock-Free
Core
Results
Options