Implement deep copy method for model.WebSocketEvent (#18977)

Этот коммит содержится в:
Claudio Costa
2021-11-22 09:54:19 +01:00
коммит произвёл GitHub
родитель 0da249c651
Коммит 3dea98ea4b
4 изменённых файлов: 195 добавлений и 2 удалений

Просмотреть файл

@@ -735,7 +735,9 @@ func (a *App) publishWebsocketEventForPermalinkPost(post *model.Post, message *m
}
return false, err
}
messageCopy := message.Copy()
// Using DeepCopy here to avoid a race condition
// between publishing the event and setting the "post" data value below.
messageCopy := message.DeepCopy()
broadcastCopy := messageCopy.GetBroadcast()
broadcastCopy.UserId = cm.UserId
messageCopy.SetBroadcast(broadcastCopy)