1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Cache the joined member count for a room state

Pushrule evaluation needs the count of joined room members and
filtering the list for joined members takes a nontrivial amount
of time, but caching it is trivial, both code and memory wise.
This commit is contained in:
David Baker
2018-02-26 16:43:26 +00:00
parent d98c803b54
commit 7e1cea1ef6
2 changed files with 17 additions and 3 deletions

View File

@@ -156,9 +156,7 @@ function PushProcessor(client) {
return false;
}
const memberCount = Object.keys(room.currentState.members).filter(function(m) {
return room.currentState.members[m].membership == 'join';
}).length;
const memberCount = room.currentState.getJoinedMemberCount();
const m = cond.is.match(/^([=<>]*)([0-9]*)$/);
if (!m) {