PLT-5678 Ensure all connections are closed on logout (#314)

This commit is contained in:
enahum 2017-03-01 12:36:23 -03:00 committed by Harrison Healey
parent 9969ac52f2
commit 542555d3bb

View file

@ -377,7 +377,17 @@ export function startPeriodicStatusUpdates() {
statusIntervalId = setInterval(
() => {
const {statuses} = getState().entities.users;
getStatusesByIds(Object.keys(statuses))(dispatch, getState);
if (!statuses) {
return;
}
const userIds = Object.keys(statuses);
if (!userIds.length) {
return;
}
getStatusesByIds(userIds)(dispatch, getState);
},
Constants.STATUS_INTERVAL
);
@ -386,7 +396,9 @@ export function startPeriodicStatusUpdates() {
export function stopPeriodicStatusUpdates() {
return async () => {
clearInterval(statusIntervalId);
if (statusIntervalId) {
clearInterval(statusIntervalId);
}
};
}