Expand description
Async retry with exponential backoff and automatic tracing.
Each retry attempt runs inside a tracing::span! so it appears in
distributed traces. If altair-otel is initialized in the same process,
retries flow to OTLP automatically.
§Example
use altair_retry::{retry, Config};
use std::time::Duration;
let cfg = Config::builder()
.name("db.connect")
.max_retries(3)
.initial_interval(Duration::from_millis(100))
.build();
retry(cfg, || async { ping().await }).await?;Modules§
- prelude
- Common imports for users of this crate.
Structs§
- Cancellation
Token - A token which can be used to signal a cancellation request to one or more tasks.
- Config
- Retry policy.
- Config
Builder - Builder for
Config. - Permanent
Error - Marker for non-retryable errors. Wrap an error with
PermanentError::wrapto short-circuit retry — the next attempt is not made and the wrapped error is returned viaError::Permanent.
Enums§
- Error
- Errors returned by
crate::retry.
Functions§
- retry
- Run
opwith retry perconfig.
Type Aliases§
- Result
- Convenience result alias.