MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / spawn_session_reaper

Function spawn_session_reaper

crates/openshell-server/src/ssh_sessions.rs:23–34  ·  view source on GitHub ↗

Spawn a background task that periodically reaps expired and revoked SSH sessions.

(store: Arc<Store>, interval: Duration)

Source from the content-addressed store, hash-verified

21
22/// Spawn a background task that periodically reaps expired and revoked SSH sessions.
23pub fn spawn_session_reaper(store: Arc<Store>, interval: Duration) {
24 tokio::spawn(async move {
25 tokio::time::sleep(interval).await;
26
27 loop {
28 if let Err(e) = reap_expired_sessions(&store).await {
29 warn!(error = %e, "SSH session reaper sweep failed");
30 }
31 tokio::time::sleep(interval).await;
32 }
33 });
34}
35
36async fn reap_expired_sessions(store: &Store) -> Result<(), String> {
37 let now_ms = now_ms();

Callers 1

run_serverFunction · 0.85

Calls 2

reap_expired_sessionsFunction · 0.85
spawnFunction · 0.50

Tested by

no test coverage detected