MM-61130: Use a channelMember map at web_hub level (#28810)
Tests at very high scale indicates that the iteration of all connections during websocket broadcast starts to become a bottleneck. To optimize this, we move the channelMember cache from inside web_conn.go to the hubConnectionIndex. This involves adding a new map keyed by the channelID and containing all webConns where the user is a member of that channel. Subsequently, a new method needed to be added to invalidate the cache which previously used to happen in web_conn. And as a last step, we remove the cache from web_conn to reduce SQL queries to the DB. https://mattermost.atlassian.net/browse/MM-61130 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
37d97e8024
Коммит
bd8774bdce
@@ -49,6 +49,7 @@ func (wr *WebSocketRouter) ServeWebSocket(conn *WebConn, r *model.WebSocketReque
|
||||
|
||||
session, err := conn.Suite.GetSession(token)
|
||||
if err != nil {
|
||||
conn.Platform.Log().Warn("Error while getting session token", mlog.Err(err))
|
||||
conn.WebSocket.Close()
|
||||
return
|
||||
}
|
||||
@@ -56,7 +57,12 @@ func (wr *WebSocketRouter) ServeWebSocket(conn *WebConn, r *model.WebSocketReque
|
||||
conn.SetSessionToken(session.Token)
|
||||
conn.UserId = session.UserId
|
||||
|
||||
conn.Platform.HubRegister(conn)
|
||||
nErr := conn.Platform.HubRegister(conn)
|
||||
if nErr != nil {
|
||||
conn.Platform.Log().Error("Error while registering to hub", mlog.String("user_id", conn.UserId), mlog.Err(nErr))
|
||||
conn.WebSocket.Close()
|
||||
return
|
||||
}
|
||||
|
||||
conn.Platform.Go(func() {
|
||||
conn.Platform.SetStatusOnline(session.UserId, false)
|
||||
|
||||
Ссылка в новой задаче
Block a user