fix: data race in PushChatHistory WebSocket writes
CD / deploy (push) Successful in 57s
CI / test (push) Successful in 1m34s
CI / docker (push) Failing after 25s

This commit is contained in:
zwitschi committed 2026-08-07 16:20:14 +02:00
1 parent 887023a491
commit 587561f9fc
1 file changed
+2
+2
View File
@@ -105,9 +105,11 @@ func (h *Hub) PushChatHistory(conn *websocket.Conn, room string, limit int) {
opp := len(messages) - 1 - i
messages[i], messages[opp] = messages[opp], messages[i]
}
h.mu.Lock()
for _, msg := range messages {
conn.WriteJSON(msg)
}
h.mu.Unlock()
}
// HandleConnection handles a new WebSocket connection.