brane_drv::gc

Function sessions

Source
pub async fn sessions(sessions: Weak<DashMap<AppId, (InstanceVm, Instant)>>)
Expand description

Can be run as a tokio background task to periodically clean the list of active sessions.

Is really quite cancellation-safe.

§Arguments

  • sessions: The DashMap of weak sessions. Note that, to avoid memory leaks because its destructor would not be run when this task is cancelled, we assume a Weak reference.

§Returns

Never, unless the referred sessions is free’d.