Only get local users

This commit is contained in:
Erik Johnston 2016-06-01 11:34:06 +01:00
parent 065e739d6e
commit 9c26b390a2
2 changed files with 6 additions and 3 deletions

View File

@ -83,10 +83,13 @@ def evaluator_for_event(event, hs, store, current_state):
e.state_key for e in current_state.values() e.state_key for e in current_state.values()
if e.type == EventTypes.Member and e.membership == Membership.JOIN if e.type == EventTypes.Member and e.membership == Membership.JOIN
) )
local_users_in_room = set(uid for uid in all_in_room if hs.is_mine_id(uid))
# users in the room who have pushers need to get push rules run because # users in the room who have pushers need to get push rules run because
# that's how their pushers work # that's how their pushers work
if_users_with_pushers = yield store.get_if_users_have_pushers(all_in_room) if_users_with_pushers = yield store.get_if_users_have_pushers(
local_users_in_room
)
users_with_pushers = set( users_with_pushers = set(
uid for uid, have_pusher in if_users_with_pushers.items() if have_pusher uid for uid, have_pusher in if_users_with_pushers.items() if have_pusher
) )
@ -96,7 +99,7 @@ def evaluator_for_event(event, hs, store, current_state):
# any users with pushers must be ours: they have pushers # any users with pushers must be ours: they have pushers
user_ids = set(users_with_pushers) user_ids = set(users_with_pushers)
for uid in users_with_receipts: for uid in users_with_receipts:
if hs.is_mine_id(uid) and uid in all_in_room: if uid in local_users_in_room:
user_ids.add(uid) user_ids.add(uid)
# if this event is an invite event, we may need to run rules for the user # if this event is an invite event, we may need to run rules for the user

View File

@ -135,7 +135,7 @@ class PusherStore(SQLBaseStore):
"get_all_updated_pushers", get_all_updated_pushers_txn "get_all_updated_pushers", get_all_updated_pushers_txn
) )
@cachedInlineCallbacks(lru=True, num_args=1) @cachedInlineCallbacks(lru=True, num_args=1, max_entries=15000)
def get_if_user_has_pusher(self, user_id): def get_if_user_has_pusher(self, user_id):
result = yield self._simple_select_many_batch( result = yield self._simple_select_many_batch(
table='pushers', table='pushers',