Skip to main content

Module retry

Module retry 

Source
Expand description

Automatic retry with exponential backoff.

This module provides retry functionality for handling transient failures in API calls. It implements exponential backoff with optional jitter to prevent thundering herd problems.

§Example

use aptos_sdk::retry::{RetryConfig, RetryPolicy};

// Create a custom retry policy
let config = RetryConfig::builder()
    .max_retries(5)
    .initial_delay_ms(100)
    .max_delay_ms(10_000)
    .exponential_base(2.0)
    .jitter(true)
    .build();

// Use with the Aptos client
let aptos = Aptos::new(AptosConfig::testnet().with_retry(config))?;

Structs§

RetryConfig
Configuration for retry behavior.
RetryConfigBuilder
Builder for RetryConfig.
RetryExecutor
Executes an async operation with automatic retry.

Traits§

RetryExt
Extension trait for adding retry capability to futures.

Functions§

retry
Convenience function to retry an operation with default config.
retry_with_config
Convenience function to retry an operation with custom config.