mulligan
A flexible retry library for Rust async operations with configurable backoff strategies and jitter.
mulligan provides a fluent API for retrying async operations with customizable retry policies, backoff strategies, and jitter. It supports both tokio and async-std runtimes.
Features
- Multiple backoff strategies:
- Fixed delay
- Linear backoff
- Exponential backoff
- Configurable jitter options:
- Full jitter
- Equal jitter
- Decorrelated jitter
- Maximum retry attempts
- Maximum delay caps
- Custom retry conditions
- Async runtime support:
tokio(viatokiofeature)async-std(viaasync-stdfeature)
Quick Start
use Duration;
async
async
Alternatively, you may provide a custom stopping condition. mulligan::until_ok() is equivalent to the custom stopping condition shown below.
async
Installation
Add this to your Cargo.toml:
[]
= { = "0.1", = ["tokio"] } # or ["async-std"]
Note: You must enable either the tokio or async-std feature, but not both.