Exponential-backoff retry for transient failures.
Retries a function up to max_attempts times with exponential backoff
and optional jitter. Useful for Docker API calls that may fail transiently
(e.g. socket hiccups, Ryuk not ready, daemon under pressure).
Example
Retry.with_backoff(fn -> Docker.ping(conn) end, max_attempts: 5)
Summary
Functions
Retries fun up to max_attempts times with exponential backoff.
Functions
@spec with_backoff( (-> {:ok, any()} | {:error, any()}), keyword() ) :: {:ok, any()} | {:error, any()}
Retries fun up to max_attempts times with exponential backoff.
Returns {:ok, result} on success or {:error, last_error} after all attempts fail.
Options
:base_ms— initial wait in milliseconds (default:200):max_ms— maximum wait cap (default:5_000):jitter— add up to this many ms of random jitter (default:100)
Example
Retry.with_backoff(fn -> Docker.ping(conn) end, max_attempts: 5)