Interface IRetryScheduler
- Namespace
- Kampute.HttpClient.Interfaces
- Assembly
- Kampute.HttpClient.dll
Defines a contract for scheduling retry attempts for an operation. This includes determining if a retry is appropriate and managing the waiting period before the next attempt.
public interface IRetryScheduler
Methods
WaitAsync(CancellationToken)
Waits for the appropriate time before the next retry attempt, according to the scheduler's strategy, and determines if a retry should be attempted.
Task<bool> WaitAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenA token that can be used to cancel the wait operation.
Returns
Remarks
The asynchronous nature of the method allows implementations to incorporate not just simple time-based waiting but also more complex logic, such as querying external services for guidance on when to retry or dynamically adjusting backoff parameters in response to system load.
Implementations should respect the provided CancellationToken to ensure that the application remains responsive, especially during shutdown sequences or when operations need to be canceled prematurely.