Fixes race condition in notification.go (#18226)
* Fixes race condition in notification.go Appending is not thread safe, this commit makes followers a map so we can add new followers from autofollow, and then adds those again to followers. * Fixes race condition
Этот коммит содержится в:
@@ -255,12 +255,12 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
followersMutex.Lock()
|
||||||
// add new followers to existing followers
|
// add new followers to existing followers
|
||||||
if threadMembership.Following && !followers.Contains(userID) {
|
if threadMembership.Following && !followers.Contains(userID) {
|
||||||
followersMutex.Lock()
|
|
||||||
followers = append(followers, userID)
|
followers = append(followers, userID)
|
||||||
followersMutex.Unlock()
|
|
||||||
}
|
}
|
||||||
|
followersMutex.Unlock()
|
||||||
|
|
||||||
membershipsMutex.Lock()
|
membershipsMutex.Lock()
|
||||||
participantMemberships[userID] = threadMembership
|
participantMemberships[userID] = threadMembership
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user