Retry policy for Docker command execution.
Configures how many times to retry a failed command, the backoff strategy between attempts, and which errors are retryable.
Examples
# Exponential backoff, 3 attempts
policy = Docker.Debug.Retry.new()
# Custom policy
policy = Docker.Debug.Retry.new(
max_attempts: 5,
backoff: :linear,
base_delay: 1_000,
max_delay: 30_000
)
Summary
Functions
Default retryable check. Retries on connection-related errors, not on validation or command errors.
Calculates the delay for a given attempt number (0-based).
Creates a new retry policy.
Types
@type backoff() :: :exponential | :linear | :constant
@type t() :: %Docker.Debug.Retry{ backoff: backoff(), base_delay: pos_integer(), max_attempts: pos_integer(), max_delay: pos_integer(), retryable?: retryable_fun() }
Functions
Default retryable check. Retries on connection-related errors, not on validation or command errors.
@spec delay(t(), non_neg_integer()) :: non_neg_integer()
Calculates the delay for a given attempt number (0-based).
Creates a new retry policy.
Options
:max_attempts- total attempts including the first (default: 3):backoff-:exponential,:linear, or:constant(default::exponential):base_delay- starting delay in ms (default: 500):max_delay- maximum delay cap in ms (default: 10_000):retryable?- function that takes an error and returns whether to retry (default: connection errors only)