MM-56906: Remove redundant calls on team switch (#30771)
On page load, we load ALL channels and channel members from all teams. But then, on team_switch, we would again load channels and channel members from that team. This was redundant and mainly kept because previously the websocket events were considered unreliable. Now with reliable websockets, and client-side pings, we can detect broken connections faster and recover without loss. Additionally, the getAllChannelMembers call would page through all responses on the client side. This was inefficient and incur extra latency. To optimize for this, we introduce server-side streaming of the full response if page is set to -1. This optimizes the intial response as well. https://mattermost.atlassian.net/browse/MM-56906 ```release-note Optimize team switch operation by removing calls to get channels and channel members. ``` Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
883711c72d
Коммит
4803892492
@@ -3077,6 +3077,20 @@ func (s SqlChannelStore) GetMembersForUserWithPagination(userId string, page, pe
|
||||
return dbMembers.ToModel(), nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetMembersForUserWithCursorPagination(userId string, perPage int, fromChannelID string) (model.ChannelMembersWithTeamData, error) {
|
||||
dbMembers := channelMemberWithTeamWithSchemeRolesList{}
|
||||
err := s.GetReplica().Select(&dbMembers, channelMembersWithSchemeSelectQuery+"WHERE ChannelMembers.UserId = ? AND ChannelId > ? ORDER BY ChannelId ASC Limit ?", userId, fromChannelID, perPage)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to find ChannelMembers data with and userId=%s", userId)
|
||||
}
|
||||
|
||||
if len(dbMembers) == 0 {
|
||||
return nil, store.NewErrNotFound("ChannelMembers", "userId="+userId)
|
||||
}
|
||||
|
||||
return dbMembers.ToModel(), nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetTeamMembersForChannel(channelID string) ([]string, error) {
|
||||
teamMemberIDs := []string{}
|
||||
if err := s.GetReplica().Select(&teamMemberIDs, `SELECT tm.UserId
|
||||
|
||||
Ссылка в новой задаче
Block a user