supervise_panics

Function supervise_panics 

Source
pub async fn supervise_panics(
    kind: &str,
    label: &str,
    max_respawns: u32,
    spawn: impl FnMut() -> JoinHandle<()>,
)
Expand description

Supervise one accept task for panics: when an incarnation ends cleanly (shutdown flush completed) supervision is done; when it panics it is respawned up to max_respawns times with a warning per respawn, and after the cap an ERROR is logged and the surface is left down — loudly, but without aborting the process.

kind names the supervised surface in the log codes (“listener”, “admin”); label identifies the instance (listener name, bind address). spawn builds one incarnation; it is called once immediately and once per respawn, so it must hand each incarnation fresh clones of everything the accept loop consumes.