Skip to main content

session_role

Function session_role 

Source
pub fn session_role(role: &str, app_session: Option<&str>) -> String
Expand description

The role a session’s worker is registered under. Without an app session it is the normalised role, so every session of that role on this instance shares one worker. With an app session (LEAN_CTX_SESSION_ID, recorded as the presence’s app_session_id) it is <role>-s<tag>, where tag is base32(blake3(domain ‖ session))[..8] and the role is cut so the whole fits the 32-character role limit. Each session then gets its own durable worker (wkr_ id), stable for the life of that app session. Cloud recomputes the id from the role as sent, so this needs nothing new on Cloud, and Cloud’s self_verify check (worker id of the verdict == worker id of the result) then tells a worker session apart from a separate reviewer session on the same host.