Optimize/fix concurrency for chat

This commit is contained in:
Gabe Kangas
2021-03-03 20:44:13 -08:00
parent 1e0b1b389d
commit 49bb899d51
5 changed files with 38 additions and 15 deletions

View File

@@ -73,6 +73,9 @@ func GetModerationChatMessages() []models.ChatEvent {
}
func GetClient(clientID string) *Client {
l.RLock()
defer l.RUnlock()
for _, client := range _server.Clients {
if client.ClientID == clientID {
return client