Skip to main content

spawn_session_reaper

Function spawn_session_reaper 

Source
pub fn spawn_session_reaper(
    state: Arc<AppState>,
    check_interval: Duration,
) -> JoinHandle<()> ⓘ
Expand description

Spawn a background task that periodically evicts idle sessions.

Every check_interval seconds, the reaper scans all sessions and removes those whose last_active is older than session_ttl_secs. The reaper calls runtime.close() on each evicted session so the transcript is saved to the storage backend before the session is dropped.