Function compute_resubmit_backoff_interval

Source
pub fn compute_resubmit_backoff_interval(
    total_age: Duration,
    base_interval_secs: i64,
    max_interval_secs: i64,
    growth_factor: f64,
) -> Option<Duration>
Expand description

Computes the resubmit interval with backoff based on total transaction age.

The interval grows by growth_factor each time the age crosses the next tier boundary:

  • age < base → None (too early to resubmit)
  • age in [1x, 1.5x) → interval = base (e.g. 10s)
  • age in [1.5x, 2.25x) → interval = base × factor (e.g. 15s)
  • age in [2.25x, 3.375x) → interval = base × factor² (e.g. 22s)
  • …capped at max_interval

With base=10, factor=1.5, max=120: 10s → 15s → 22s → 33s → 50s → 75s → 113s → 120s (capped)

Returns the backoff interval to compare against time since last submission (sent_at).