RetryPolicyExtensions Class

Namespace
Kampute.Resilience
Assembly
  • Kampute.Resilience.dll

Definition

Provides extension methods for retry policies whose configuration depends on the result type.
public static class RetryPolicyExtensions
Inheritance

Methods

DisposeDiscarded<T>(this RetryPolicy<T>)

Creates a policy that disposes each result that execution does not return.
public static RetryPolicy<T> DisposeDiscarded<T>(this RetryPolicy<T> policy)
	where T : IDisposable

Type Parameters

T
The disposable type returned by the operations the policy runs.

Parameters

policy RetryPolicy<T>
The policy to extend.

Returns

RetryPolicy<T>
A new policy that invokes the discard handlers of policy and then disposes the discarded result.

Exceptions

ArgumentNullException
Thrown if policy is null.

Remarks

A null result is skipped. The result that execution returns is not disposed; it remains the caller's. See RetryPolicy<T>.OnDiscarded(Action<T>) for when a result is discarded.