Skip to main content

with_retry

Function with_retry 

Source
pub async fn with_retry<R, F, Fut>(request: F) -> Result<R, Error>
where F: FnMut() -> Fut, Fut: Future<Output = Result<R, Error>>,
Expand description

Execute an HTTP request with automatic retry on transient failures.

This function wraps a request closure with exponential backoff retry logic. It will retry on timeouts, connection errors, and 5xx server errors.

§Arguments

  • request - Closure that creates and executes the request

§Errors

Returns the final error after all retry attempts are exhausted.