Skip to main content

spawn_reaper

Function spawn_reaper 

Source
pub fn spawn_reaper(
    storage: Arc<dyn StorageBackend>,
    router: Arc<Router>,
    interval: Duration,
) -> JoinHandle<()> ⓘ
Expand description

Spawns a background task that reaps on a fixed interval for the lifetime of the process, on whichever replica wins the lock.

The lock is taken once and held, rather than passed around each tick: a stable leader avoids re-contending every interval, and because the lock lives on a held connection, a crashed leader releases it automatically and the next tick elsewhere picks the work up.