mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 19:33:09 -06:00
Fix nil pointer and goroutine safety in typing cache
Signed-off-by: Alex Chen <minecnly@gmail.com>
This commit is contained in:
parent
55a4e6061a
commit
ba35a0a96d
5
typingserver/cache/cache.go
vendored
5
typingserver/cache/cache.go
vendored
|
|
@ -62,11 +62,12 @@ func (t *TypingCache) GetTypingUsersIfUpdatedAfter(
|
|||
roomID string, position int64,
|
||||
) (users []string, updated bool) {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
|
||||
roomData, ok := t.data[roomID]
|
||||
userSet := roomData.userSet
|
||||
t.RUnlock()
|
||||
if ok && roomData.syncPosition > position {
|
||||
updated = true
|
||||
userSet := roomData.userSet
|
||||
users = make([]string, 0, len(userSet))
|
||||
for userID := range userSet {
|
||||
users = append(users, userID)
|
||||
|
|
|
|||
Loading…
Reference in a new issue