Skip to main content

run_config_reload_supervisor

Function run_config_reload_supervisor 

Source
pub async fn run_config_reload_supervisor<N, R, RFut, F, Fut>(
    notifier: Arc<N>,
    config: ConfigReloadWorkerConfig,
    shutdown: CancellationToken,
    reconcile: R,
    reload: F,
) -> Result<()>
where N: ConfigChangeNotifier + ?Sized, R: FnMut() -> RFut, RFut: Future<Output = Result<()>>, F: FnMut(ConfigReloadMessage) -> Fut, Fut: Future<Output = Result<()>>,
Expand description

Runs a reconnecting reload subscription with authoritative reconciliation.

reconcile runs after every successful subscription, including the initial connection. This closes the race between the product’s startup snapshot load and the moment pub/sub begins receiving notifications. After a disconnect it also repairs any changes missed while the transient transport was unavailable.

A disconnect is any of: subscribe failure, transport stream error or ending, and local broadcast lag (the receiver fell behind and events were dropped). Each one is observed, waited out with bounded exponential backoff (250 ms initial, 30 s cap, jittered; the failure counter resets after a subscription stays stable for 30 s), then followed by a fresh subscription and reconcile. The loop only returns when shutdown is cancelled.