pub struct RetryConfig {
pub max_retries: u32,
pub initial_delay_ms: u64,
pub max_delay_ms: u64,
pub backoff_multiplier: f32,
pub outbox_max_lifetime_ms: u64,
pub pending_message_max_lifetime_ms: u64,
pub edge_driven_unreachable_dm: bool,
}Expand description
Configuration for retry behavior.
Fields§
§max_retries: u32Maximum number of retries per message.
initial_delay_ms: u64Initial retry delay in milliseconds.
max_delay_ms: u64Maximum retry delay in milliseconds.
backoff_multiplier: f32Backoff multiplier for exponential backoff.
outbox_max_lifetime_ms: u64Maximum lifetime for messages in the outbox (milliseconds).
pending_message_max_lifetime_ms: u64Maximum lifetime for messages waiting on MLS session establishment.
edge_driven_unreachable_dm: boolOpt-in: treat a durably-unreachable direct message as EDGE-DRIVEN once its escalating reachability probe has run a few times, instead of the default of probing it forever at the 15s->600s cap on every carrier.
Default false preserves the documented contract (a parked message
“never goes fully quiet”; see docs/message-delivery.md) and every
existing native/third-party app’s behaviour is unchanged. When true,
after a bounded number of probes the message stops being timed-probed
and rests in the outbox, re-driven only when the peer next proves
reachable (an inbound frame or presence-online edge flushes it). It also
lets a restart skip re-driving a durably-failing backlog.
This trades the SDK’s “self-recovers even for a silent returning peer with no presence” guarantee for zero steady-state relay traffic to gone peers. It is correct for deployments whose peers always interact or advertise presence on return (e.g. a machine-to-machine capability exchange), and MUST NOT be enabled for consumers that rely on the timed probe as their only recovery path.
Implementations§
Source§impl RetryConfig
impl RetryConfig
Sourcepub fn delay_for_retry(&self, retry_count: u32) -> u64
pub fn delay_for_retry(&self, retry_count: u32) -> u64
Calculates the backoff delay for the given retry count:
initial_delay_ms * backoff_multiplier^retry_count, clamped to
max_delay_ms.
Computed in f64 and clamped before the integer cast, so it is total
over all configs: f64::min returns the other operand when one side
is NaN (NaN/infinity collapse to max_delay_ms), and float-to-int
as casts saturate.