Skip to main content

dispatch_session_event_async

Function dispatch_session_event_async 

Source
pub async fn dispatch_session_event_async(
    reload_context: &ReloadContext,
    tag: EventTag,
) -> Option<String>
Expand description

Dispatch a no-payload lifecycle event (e.g. SessionStart, SessionShutdown, the rpi-specific BeforeTuiStart) to every extension handler subscribed to that tag, with veto + timeout semantics (P1).

Resolves the current extension session from the reload cell so a /reload-swapped session is honored. Each handler runs on a blocking thread with a per-event timeout ([rpi_extensions::lifecycle_timeout_for]); a handler returning rpi_plugin_sdk::EVENT_HANDLER_ABORT vetoes the phase and this returns Some(reason). No-op (None) when no plugins loaded, no handler subscribes, or the registry is stale.

The caller decides what a veto means: a BeforeTuiStart veto aborts startup (never enter the TUI); SessionStart/SessionShutdown vetoes are advisory (the session is already up or already closing).