Skip to content

Releases: kampute/resilience

Release list

1.1.0

Choose a tag to compare

@kampute kampute released this 05 Oct 13:12
Immutable release. Only release title and notes can be modified.

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. RetrySession has 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. WaitToRetry and WaitToRetryAsync both 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 the JitterModifier and ExponentialBackoffStrategy constructors now throw ArgumentOutOfRangeException for a NaN jitter factor or multiplier. Before, a NaN jitter factor silently turned retrying off, and a NaN multiplier allowed only one retry.
  • RetryStrategies.Exponential with a zero initial delay, and RetryStrategies.Fibonacci with a zero step, no longer stop retrying after many retries: 1,024 for Exponential with the default multiplier, and 1,475 for Fibonacci.

1.0.0

Choose a tag to compare

@kampute kampute released this 04 Oct 13:34
Immutable release. Only release title and notes can be modified.

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 RetryOn call, and Execute or ExecuteAsync called directly on a strategy, retry every exception except caller cancellation. Call RetryOn to 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.MaxValue milliseconds) ends retrying instead of waiting.
  • A delay from OverrideDelay replaces the strategy's delay after its modifiers, so it can exceed WithMaxDelay or the time remaining under WithMaxElapsedTime.
  • 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.

NuGet package