Expand description
Supervised background loops.
A plain tokio::spawned loop that panics dies silently — the scheduler,
reflector, or heartbeat simply stops until the process restarts, with
nothing but one log line at panic time. Loops spawned through
spawn_supervised instead restart with capped exponential backoff, and
every restart is counted in a process-wide registry that insights
surfaces — “scheduler restarted 14× today” becomes visible instead of a
mystery.
Functions§
- restart_
counts - Snapshot of
(task_name, restart_count)sorted by name. Empty when no supervised task has ever panicked. - spawn_
supervised - Spawn a background loop that survives its own panics.
makebuilds 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).