Table of Contents

Class UniformStrategy

Namespace
Kampute.HttpClient.RetryManagement.Strategies
Assembly
Kampute.HttpClient.dll

A retry strategy that schedules retries with a uniform delay.

public sealed class UniformStrategy : IRetryStrategy
Inheritance
UniformStrategy
Implements
Inherited Members
Extension Methods

Remarks

The UniformStrategy class provides a retry mechanism with a constant wait time between retries. This strategy is useful for scenarios where a predictable retry pattern is desired, applying the same delay duration between each retry attempt without regard to the number of attempts made or the total elapsed time.

Constructors

UniformStrategy(TimeSpan)

Initializes a new instance of the UniformStrategy class with a specified delay duration between retry attempts.

public UniformStrategy(TimeSpan delay)

Parameters

delay TimeSpan

The delay duration between retry attempts.

Properties

Delay

Gets the delay duration between retries.

public TimeSpan Delay { get; }

Property Value

TimeSpan

The delay duration between retries.

Methods

TryGetRetryDelay(TimeSpan, uint, out TimeSpan)

Returns a uniform delay for every retry attempt.

public bool TryGetRetryDelay(TimeSpan elapsed, uint attempts, out TimeSpan delay)

Parameters

elapsed TimeSpan

The total time elapsed since the start of retry attempts. This parameter is ignored in this implementation.

attempts uint

The number of retry attempts made so far. This parameter is ignored in this implementation.

delay TimeSpan

When this method returns, contains the calculated delay for the next retry attempt. This parameter is passed uninitialized.

Returns

bool

Always returns true, indicating that a retry attempt should be made after the calculated delay.