[MM-57745] Fetch threads of the current channel only when root post is missing from the store in new posted event
Statuses and user profiles on each new messages have to be fetched for the post users and its mentions (Blue bar), to solve that polling of these can be done. However after we did that we saw the polling of statuses and user profiles requests got considerably down but the requests to threads was relatively still higher (Pink bar). So this improvement doesn't not fetch the root post along with the complete threads of the incoming new post from another channel. This improved the calls to threads from 120 to just 8 calls per 2 mins an improvement of 93%.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
effb374482
Коммит
0948ce1776
@@ -44,12 +44,13 @@ export default function ChannelController(props: Props) {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let loadStatusesIntervalId: ReturnType<typeof setInterval>;
|
||||
let loadStatusesIntervalId: NodeJS.Timeout;
|
||||
if (enabledUserStatuses) {
|
||||
loadStatusesIntervalId = setInterval(() => {
|
||||
dispatch(loadStatusesForChannelAndSidebar());
|
||||
}, Constants.STATUS_INTERVAL);
|
||||
}
|
||||
|
||||
return () => {
|
||||
clearInterval(loadStatusesIntervalId);
|
||||
};
|
||||
|
||||
@@ -10,6 +10,7 @@ import {logError} from 'mattermost-redux/actions/errors';
|
||||
import {getGroups, getAllGroupsAssociatedToChannelsInTeam, getAllGroupsAssociatedToTeam, getGroupsByUserIdPaginated} from 'mattermost-redux/actions/groups';
|
||||
import {forceLogoutIfNecessary} from 'mattermost-redux/actions/helpers';
|
||||
import {getTeamByName, selectTeam} from 'mattermost-redux/actions/teams';
|
||||
import {getIsUserStatusesConfigEnabled} from 'mattermost-redux/selectors/entities/common';
|
||||
import {getLicense} from 'mattermost-redux/selectors/entities/general';
|
||||
import {isCustomGroupsEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||
@@ -38,7 +39,13 @@ export function initializeTeam(team: Team): ActionFuncAsync<Team, GlobalState> {
|
||||
return {error: error as ServerError};
|
||||
}
|
||||
|
||||
dispatch(loadStatusesForChannelAndSidebar());
|
||||
const enabledUserStatuses = getIsUserStatusesConfigEnabled(state);
|
||||
|
||||
if (enabledUserStatuses) {
|
||||
// This is the first time in the pool of user statuses that we request,
|
||||
// subsequent requests will be done via setInterval at channel_controller.tsx
|
||||
dispatch(loadStatusesForChannelAndSidebar());
|
||||
}
|
||||
|
||||
const license = getLicense(state);
|
||||
const customGroupEnabled = isCustomGroupsEnabled(state);
|
||||
|
||||
Ссылка в новой задаче
Block a user