[MM-19914] Fix data races in WebSocketEvent (#13039)
* Make WebSocketEvent type immutable * Update code to use updated immutable WebSocketEvent type * Export WebSocketEvent fields and mark them as deprecated
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9ab7bee0a6
Коммит
80dd2915db
@@ -1367,7 +1367,7 @@ func TestConvertChannelToPrivate(t *testing.T) {
|
||||
for {
|
||||
select {
|
||||
case resp := <-WebSocketClient.EventChannel:
|
||||
if resp.Event == model.WEBSOCKET_EVENT_CHANNEL_CONVERTED && resp.Data["channel_id"].(string) == publicChannel2.Id {
|
||||
if resp.EventType() == model.WEBSOCKET_EVENT_CHANNEL_CONVERTED && resp.GetData()["channel_id"].(string) == publicChannel2.Id {
|
||||
eventHit = true
|
||||
}
|
||||
case <-stop:
|
||||
@@ -2426,7 +2426,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
||||
})
|
||||
|
||||
wsr := <-wsClient.EventChannel
|
||||
require.Equal(t, model.WEBSOCKET_EVENT_HELLO, wsr.Event)
|
||||
require.Equal(t, model.WEBSOCKET_EVENT_HELLO, wsr.EventType())
|
||||
|
||||
// requirePost listens for websocket events and tries to find the post matching
|
||||
// the expected post's channel and message.
|
||||
@@ -2435,7 +2435,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
||||
for {
|
||||
select {
|
||||
case event := <-wsClient.EventChannel:
|
||||
postData, ok := event.Data["post"]
|
||||
postData, ok := event.GetData()["post"]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user