Retry Module API Reference¶
This section documents the internals of the retry
module in Bijux CLI.
bijux_cli.contracts.retry ¶
Defines the contract for operation retry policies.
This module specifies the RetryPolicyProtocol
, a formal interface that any service providing retry logic for potentially failing operations must implement. This is particularly useful for handling transient errors in network requests or other I/O-bound tasks.
RetryPolicyProtocol ¶
Bases: Protocol
Defines the contract for retry policies in asynchronous operations.
This interface specifies the methods for executing an operation with retry logic (e.g., exponential backoff) and for resetting the policy's internal state.
reset ¶
Resets the internal state of the retry policy.
This is useful for reusing a policy instance for a new, independent operation.
run async
¶
Runs an asynchronous operation with a retry policy.
Implementations of this method will repeatedly call the supplier
until it succeeds or the retry policy is exhausted.
Parameters:
-
supplier
(Callable[[], Awaitable[T]]
) –A no-argument function that returns an awaitable (e.g., a coroutine).
-
seconds
(float
, default:1.0
) –The timeout for each attempt in seconds.
Returns:
-
T
(T
) –The successful result of the operation.