MM-24759: fix order of calling SetstatusOnline (#14450)
We would call SetStatusOnline in a goroutine before actually calling HubRegister. This could cause the message not to be sent after all, because there's no guarantee that Register would actually happen before it. To fix it, we just change the order of things. Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3f6c9ab40c
Коммит
c7f53cf02b
@@ -54,17 +54,17 @@ func (wr *WebSocketRouter) ServeWebSocket(conn *WebConn, r *model.WebSocketReque
|
||||
return
|
||||
}
|
||||
|
||||
wr.app.Srv().Go(func() {
|
||||
wr.app.SetStatusOnline(session.UserId, false)
|
||||
wr.app.UpdateLastActivityAtIfNeeded(*session)
|
||||
})
|
||||
|
||||
conn.SetSession(session)
|
||||
conn.SetSessionToken(session.Token)
|
||||
conn.UserId = session.UserId
|
||||
|
||||
wr.app.HubRegister(conn)
|
||||
|
||||
wr.app.Srv().Go(func() {
|
||||
wr.app.SetStatusOnline(session.UserId, false)
|
||||
wr.app.UpdateLastActivityAtIfNeeded(*session)
|
||||
})
|
||||
|
||||
resp := model.NewWebSocketResponse(model.STATUS_OK, r.Seq, nil)
|
||||
hub := wr.app.GetHubForUserId(conn.UserId)
|
||||
if hub == nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user