retry

Attribute Macro retry 

Source
#[retry]
Available on crate feature resilience only.
Expand description

Re-export retry attribute macro Attribute macro for automatic retry with exponential backoff

Wraps an async function with retry logic using RetryExecutor.

§Example

use allframe_macros::retry;

#[retry(max_retries = 3, initial_interval_ms = 100)]
async fn fetch_data() -> Result<String, std::io::Error> {
    // This will be retried up to 3 times on failure
    reqwest::get("https://api.example.com/data")
        .await?
        .text()
        .await
}

§Parameters

  • max_retries - Maximum retry attempts (default: 3)
  • initial_interval_ms - Initial backoff in milliseconds (default: 500)
  • max_interval_ms - Maximum backoff in milliseconds (default: 30000)
  • multiplier - Backoff multiplier (default: 2.0)