Repository navigation
Releases: kampute/resilience
Releases · kampute/resilience
Release list
1.1.0
Kampute.Resilience 1.1.0 lets a derived retry session make its own retry decisions while the session keeps counting retries, enforcing its delay limit, and waiting. It also fixes two edge cases in the built-in strategies.
New
- Custom retry decisions in sessions.
RetrySessionhas a new protected virtual method,TryGetRetryDelay. Override it in a derived session to decide whether to retry and how long to wait, for example to honor a retry time that a server suggests.WaitToRetryandWaitToRetryAsyncboth use it, and the session does not retry when a delay is longer than about 24.8 days. See Custom Sessions in the user guide.
Fixes
WithJitter,RetryStrategies.Exponential, and theJitterModifierandExponentialBackoffStrategyconstructors now throwArgumentOutOfRangeExceptionfor aNaNjitter factor or multiplier. Before, aNaNjitter factor silently turned retrying off, and aNaNmultiplier allowed only one retry.RetryStrategies.Exponentialwith a zero initial delay, andRetryStrategies.Fibonacciwith a zero step, no longer stop retrying after many retries: 1,024 forExponentialwith the default multiplier, and 1,475 forFibonacci.
1.0.0
This is the first public release, so there is nothing to migrate from. See the User Guide for everything beyond the README.
Behavior worth knowing
- A policy without a
RetryOncall, andExecuteorExecuteAsynccalled directly on a strategy, retry every exception except caller cancellation. CallRetryOnto limit retries to failures that can clear on their own. - When retries for a returned value run out, execution returns the last value instead of throwing.
- A delay longer than about 24.8 days (
int.MaxValuemilliseconds) ends retrying instead of waiting. - A delay from
OverrideDelayreplaces the strategy's delay after its modifiers, so it can exceedWithMaxDelayor the time remaining underWithMaxElapsedTime. - Asynchronous execution still allocates for the wait between attempts and for the async state machine. Only synchronous execution adds no allocations of its own for each retry.