Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix CPU spin on joining large room #2128

Merged
merged 2 commits into from
Aug 23, 2018
Merged

Fix CPU spin on joining large room #2128

merged 2 commits into from
Aug 23, 2018

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Aug 22, 2018

checkIfAlone() filters the whole member list, which is fine until
we do it once for every membership event, then we have an n^2
problem. Move it into the rate limited function.

Fixes element-hq/element-web#7163

checkIfAlone() filters the whole member list, which is fine until
we do it once for every membership event, then we have an n^2
problem. Move it into the rate limited function.

Fixes element-hq/element-web#7163
@dbkr dbkr requested a review from a team August 22, 2018 13:35
@@ -717,6 +716,7 @@ module.exports = React.createClass({
// refresh the conf call notification state
this._updateConfCallNotification();
this._updateDMState();
this._checkIfAlone(this.state.room);
}, 500),

_checkIfAlone: function(room) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this should now be implemented with roomstate getJoinedMemberCount + getInvitedMemberCount, which should be more performant and also more correct in case of lazy loading.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh, good point

@dbkr dbkr merged commit 269670e into develop Aug 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants