chore: Add comment and warning to unhappy path

This commit is contained in:
Ginger 2025-12-31 15:25:48 -05:00 committed by Jade Ellis
parent a10bd71945
commit 88c84f221f
No known key found for this signature in database
GPG key ID: 8705A2A3EBF77BD2

View file

@ -179,6 +179,17 @@ pub async fn leave_room(
.state_cache
.left_state(user_id, room_id)
.await
.inspect_err(|err| {
// `left_state` may return an Err if the user _is_ in the room they're
// trying to leave, but the membership cache is incorrect and
// they're cached as being joined. In this situation
// we save a `None` to the `roomuserid_leftcount` table, which generates
// and sends a dummy leave to the client.
warn!(
"Trying to leave room not cached as leave, sending dummy leave \
event to client"
);
})
.unwrap_or_default()
},
}