From c9564e08ba698771d59602d48b2f6b2cf389c5a9 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Thu, 2 Feb 2023 16:47:39 +0000 Subject: [PATCH] Fix stupid bug --- synapse/push/bulk_push_rule_evaluator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/synapse/push/bulk_push_rule_evaluator.py b/synapse/push/bulk_push_rule_evaluator.py index bc3a0e6d61..adc89c534d 100644 --- a/synapse/push/bulk_push_rule_evaluator.py +++ b/synapse/push/bulk_push_rule_evaluator.py @@ -135,6 +135,7 @@ class BulkPushRuleEvaluator: # little, we can skip fetching a huge number of push rules in large rooms. # This helps make joins and leaves faster. if event.type == EventTypes.Member: + local_users = [] # We never notify a user about their own actions. This is enforced in # `_action_for_event_by_user` in the loop over `rules_by_user`, but we # do the same check here to avoid unnecessary DB queries. @@ -146,8 +147,6 @@ class BulkPushRuleEvaluator: ) if target_already_in_room: local_users = [event.state_key] - else: - return {} else: # We get the users who may need to be notified by first fetching the # local users currently in the room, finding those that have push rules, @@ -174,6 +173,9 @@ class BulkPushRuleEvaluator: local_users = list(local_users) local_users.append(invited) + if not local_users: + return {} + rules_by_user = await self.store.bulk_get_push_rules(local_users) logger.debug("Users in room: %s", local_users)