Skip to main content

Module retry

Module retry 

Source
Expand description

Retry policy for handling transient failures.

The retry policy automatically retries failed operations with configurable backoff strategies.

§Backoff Strategies

  • Fixed: Wait a constant duration between retries
  • Exponential: Increase delay exponentially with each retry

§Examples

use do_over::{policy::Policy, retry::RetryPolicy};
use std::time::Duration;

// Fixed backoff: 3 retries with 100ms delay
let policy = RetryPolicy::fixed(3, Duration::from_millis(100));

// Exponential backoff: 3 retries, starting at 100ms, doubling each time
let policy = RetryPolicy::exponential(3, Duration::from_millis(100), 2.0);

let result = policy.execute(|| async {
    Ok::<_, std::io::Error>("success")
}).await?;

Structs§

RetryPolicy
A policy that retries failed operations with configurable backoff.

Enums§

Backoff
Backoff strategy for retry delays.