Skip to main content

Module restart

Module restart 

Source
Expand description

Restart supervision for script subprocesses.

ScriptConfig::restart_policy / restart_delay_ms are accepted by the config layer but the actual supervision happens in the frontend event loop, which is the only place that can re-register a terminal observer and re-spawn against a config index. This module owns the decision — a pure state machine with no I/O — so it stays deterministic and unit-testable.

The orchestrator drives one ScriptRestartState per script slot:

  1. On a fresh process start, call ScriptRestartState::on_started.
  2. Each frame, poll the process; if it has exited, call ScriptRestartState::on_exit (only when not already pending) to get the first reaction.
  3. While a restart is pending, call ScriptRestartState::poll to learn when the delay has elapsed.

Structs§

ScriptRestartState
Pure per-slot restart supervisor.

Enums§

RestartAction
What the supervisor wants the orchestrator to do this frame for one slot.

Constants§

MAX_RESTART_ATTEMPTS
Maximum number of consecutive restart attempts before the supervisor gives up.
RESTART_GRACE
A process that survives this long before exiting resets the failure counter.