Skip to main content

Module retry

Module retry 

Source
Expand description

Exponential-backoff retry math + “is it permanent?” classifier. Exponential-backoff retry helpers for SMTP outbound delivery.

Backed by mailrs_backoff::Backoff::smtp_outbound. Replaces the previous hardcoded 8-slot schedule with a clean parametric curve; gains Full jitter to avoid thundering-herd on shared MX downtime.

Functions§

retry_delay_secs
Retry delay in seconds for attempt n (0-indexed), deterministic schedule (no jitter). For jittered scheduling use retry_delay_secs_jittered.
retry_delay_secs_jittered
Retry delay in seconds with Full jitter applied. Caller supplies a random seed (e.g. Instant::now().elapsed().as_nanos() as u64 or rand::random::<u64>()). The same (attempt, seed) pair always yields the same delay, so tests can reproduce.
should_bounce
Should this attempt give up and bounce the message? Returns true when attempt >= max_attempts. Equivalent to mailrs_backoff::Backoff::should_give_up; kept for back-compat.