Skip to main content

spawn_supervised

Function spawn_supervised 

Source
pub fn spawn_supervised<F, Fut>(task_name: &'static str, make: F)
where F: Fn() -> Fut + Send + 'static, Fut: Future<Output = ()> + Send + 'static,
Expand description

Spawn a background loop that survives its own panics. make builds a fresh instance of the loop future; on panic the task is rebuilt and restarted after a capped exponential backoff. A future that returns normally ends the supervision (loops that finish on purpose stay finished).