Skip to main content

Crate altair_retry

Crate altair_retry 

Source
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§

CancellationToken
A token which can be used to signal a cancellation request to one or more tasks.
Config
Retry policy.
ConfigBuilder
Builder for Config.
PermanentError
Marker for non-retryable errors. Wrap an error with PermanentError::wrap to short-circuit retry — the next attempt is not made and the wrapped error is returned via Error::Permanent.

Enums§

Error
Errors returned by crate::retry.

Functions§

retry
Run op with retry per config.

Type Aliases§

Result
Convenience result alias.