pub struct EngineProcessManager { /* private fields */ }Expand description
Manages the rivet-engine subprocess.
The engine is intentionally orphaned: dropping the manager (or having the host process exit) must NOT terminate the engine. This lets a dev-server restart of the rivetkit host reattach to the same long-lived engine and keep all in-flight actor state. To honor that contract:
Command::kill_on_dropis left at its default (false) so the tokioChilddoes not send SIGKILL on drop.- Stdout and stderr are routed to log files at spawn time so the engine’s write fds remain valid after the host’s pipes close.
- On startup we probe the configured endpoint and reuse a healthy engine instead of spawning a duplicate.
When we spawn the engine, watcher holds a tokio task that owns the
Child and awaits child.wait() so we get a log line if the engine dies
while rivetkit is still running. On Drop we abort the watcher; aborting
drops the Child without killing it (kill_on_drop=false), so the engine
stays running and gets reparented to init when rivetkit exits.
watcher is None when we attached to an already-running engine.
Implementations§
Source§impl EngineProcessManager
impl EngineProcessManager
pub async fn start_or_reuse(config: EngineResolverConfig) -> Result<Self>
Sourcepub fn startup(&self) -> &EngineStartup
pub fn startup(&self) -> &EngineStartup
How the engine was obtained: freshly spawned or reused.