Module adaptive_retry

Module adaptive_retry 

Source
Expand description

Adaptive retry policies based on failure patterns.

This module provides intelligent retry logic that adapts based on observed failure patterns, success rates, and error types. Instead of using static retry configurations, it dynamically adjusts retry behavior to optimize for both success rate and resource utilization.

§Example

use chie_core::adaptive_retry::{AdaptiveRetryPolicy, FailureType};

let mut policy = AdaptiveRetryPolicy::new();

// Record failures and successes
policy.record_failure("peer1", FailureType::Timeout);
policy.record_failure("peer1", FailureType::Timeout);
policy.record_success("peer1");

// Get recommended retry config for this peer
let should_retry = policy.should_retry("peer1", 1);
let delay = policy.retry_delay("peer1", 1);

Structs§

AdaptiveRetryPolicy
Adaptive retry policy that learns from failure patterns.
FailurePatterns
Failure pattern statistics for a specific target.

Enums§

FailureType
Types of failures that can occur.