diff --git a/syncapi/notifier/notifier.go b/syncapi/notifier/notifier.go index a06d6bf2e..4e1a3c2a3 100644 --- a/syncapi/notifier/notifier.go +++ b/syncapi/notifier/notifier.go @@ -250,6 +250,8 @@ func (n *Notifier) OnNewPresence( } func (n *Notifier) SharedUsers(userID string) (sharedUsers []string) { + n.mapLock.RLock() + defer n.mapLock.RUnlock() for roomID, users := range n.roomIDToJoinedUsers { if _, ok := users[userID]; ok { sharedUsers = append(sharedUsers, n.JoinedUsers(roomID)...) @@ -259,6 +261,8 @@ func (n *Notifier) SharedUsers(userID string) (sharedUsers []string) { } func (n *Notifier) IsSharedUser(userA, userB string) bool { + n.mapLock.RLock() + defer n.mapLock.RUnlock() var okA, okB bool for _, users := range n.roomIDToJoinedUsers { _, okA = users[userA]