TaskEndurer 0.1.0
See the version list below for details.
dotnet add package TaskEndurer --version 0.1.0
NuGet\Install-Package TaskEndurer -Version 0.1.0
<PackageReference Include="TaskEndurer" Version="0.1.0" />
<PackageVersion Include="TaskEndurer" Version="0.1.0" />
<PackageReference Include="TaskEndurer" />
paket add TaskEndurer --version 0.1.0
#r "nuget: TaskEndurer, 0.1.0"
#:package TaskEndurer@0.1.0
#addin nuget:?package=TaskEndurer&version=0.1.0
#tool nuget:?package=TaskEndurer&version=0.1.0
Summary
Task Endurer is a library that lets you easily retry asynchronous tasks based on a given policy.
Getting started
Installation via Package Manager Console in Visual Studio:
PM> Install-Package TaskEndurer
Installation via .NET CLI:
> dotnet add <TARGET PROJECT> package TaskEndurer
Usage
The main goal of Task Endurer is to retry a task based on a given policy in a minimal fashion.
The policy is defined by the RetryPolicy class, which is constructed by the RetryPolicyBuilder class.
Example
var policy = RetryPolicyBuilder().Create() // create a policy builder
.WithMaxRetries(3) // Maximum number of retries is 3
.WithDelay(TimeSpan.FromSeconds(1)) // Delay between retries is 1 second
The policy can then be used to build an executor: The executor can be used to execute a task. The task will be retried if it fails, based on the policy.
var executor = policy.Build(); // Build the executor based on the policy.
executor.ExecuteAsync(async () => await Task.Delay(1000)); // Execute the task using the executor.
Policy builder options
| Option | Description |
|---|---|
| WithMaxRetries | Specified the maximum number of retries before the task will actually fail. |
| WithDelay | Specifies the delay between retries. |
| WithBackoff | Specifies the backoff strategy. |
| WithMaxDuration | Specifies the maximum duration to retry. |
| ContinueOnException | Register expected exception types, to indicate whether to continue retrying or not after the maximum duration or maximum number of retries have been reached. |
| WithGracefulExceptionHandling | Specifies that any exceptions should be gracefully handled and not thrown after the maximum duration or maximum number of retries have been reached. |
Backoff strategies
| Strategy | Description |
|---|---|
| Linear | The base delay time is equal to the attempt count. |
| Exponential | Increases the time between retries exponentially by the retry count. |
| Fibonacci | The base delay time is returned as the Fibonacci number corresponding to the current attempt. |
| Fixed | The base delay time is calculated as a fixed value. |
| Polynomial | The base delay time is calculated as: ae where:a is the number of unsuccessful attempts that have been made, e is the exponent configured for the strategy. |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.