Start timer for anonymous sessions to join room before sending response.

Fixes flaky "TestExpectAnonymousJoinRoomAfterLeave" under load.
This commit is contained in:
Joachim Bauch 2025-12-11 09:58:36 +01:00
commit 78d74ea3ee
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

4
hub.go
View file

@ -1719,11 +1719,11 @@ func (h *Hub) processRoom(sess Session, message *ClientMessage) {
if roomId == "" {
// We can handle leaving a room directly.
if session.LeaveRoomWithMessage(true, message) != nil {
// User was in a room before, so need to notify about leaving it.
h.sendRoom(session, message, nil)
if session.UserId() == "" && session.ClientType() != HelloClientTypeInternal {
h.startWaitAnonymousSessionRoom(session)
}
// User was in a room before, so need to notify about leaving it.
h.sendRoom(session, message, nil)
}
return