[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
@@ -487,7 +487,7 @@ func TestCreatePostSendOutOfChannelMentions(t *testing.T) {
|
||||
for waiting {
|
||||
select {
|
||||
case event := <-WebSocketClient.EventChannel:
|
||||
require.NotEqual(t, model.WEBSOCKET_EVENT_EPHEMERAL_MESSAGE, event.Event, "should not have ephemeral message event")
|
||||
require.NotEqual(t, model.WEBSOCKET_EVENT_EPHEMERAL_MESSAGE, event.EventType(), "should not have ephemeral message event")
|
||||
case <-timeout:
|
||||
waiting = false
|
||||
}
|
||||
@@ -506,12 +506,12 @@ func TestCreatePostSendOutOfChannelMentions(t *testing.T) {
|
||||
for waiting {
|
||||
select {
|
||||
case event := <-WebSocketClient.EventChannel:
|
||||
if event.Event != model.WEBSOCKET_EVENT_EPHEMERAL_MESSAGE {
|
||||
if event.EventType() != model.WEBSOCKET_EVENT_EPHEMERAL_MESSAGE {
|
||||
// Ignore any other events
|
||||
continue
|
||||
}
|
||||
|
||||
wpost := model.PostFromJson(strings.NewReader(event.Data["post"].(string)))
|
||||
wpost := model.PostFromJson(strings.NewReader(event.GetData()["post"].(string)))
|
||||
|
||||
acm, ok := wpost.Props[model.PROPS_ADD_CHANNEL_MEMBER].(map[string]interface{})
|
||||
require.True(t, ok, "should have received ephemeral post with 'add_channel_member' in props")
|
||||
|
||||
Ссылка в новой задаче
Block a user