diff options
author | Erik Johnston <erikj@jki.re> | 2018-02-26 14:45:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-26 14:45:40 +0000 |
commit | e5b4a208ced9df795e1944cda79846690530eac7 (patch) | |
tree | 5bd57b753d84383966b9f14346ade11faae9e168 /synapse/push | |
parent | Merge pull request #2894 from matrix-org/erikj/handle_unpersisted_events_push (diff) | |
parent | Update comments (diff) | |
download | synapse-e5b4a208ced9df795e1944cda79846690530eac7.tar.xz |
Merge pull request #2892 from matrix-org/erikj/batch_inserts_push_actions
Batch inserts into event_push_actions_staging
Diffstat (limited to '')
-rw-r--r-- | synapse/push/bulk_push_rule_evaluator.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/synapse/push/bulk_push_rule_evaluator.py b/synapse/push/bulk_push_rule_evaluator.py index bf4f1c5836..7c680659b6 100644 --- a/synapse/push/bulk_push_rule_evaluator.py +++ b/synapse/push/bulk_push_rule_evaluator.py @@ -144,6 +144,7 @@ class BulkPushRuleEvaluator(object): Deferred """ rules_by_user = yield self._get_rules_for_event(event, context) + actions_by_user = {} room_members = yield self.store.get_joined_users_from_context( event, context @@ -189,14 +190,17 @@ class BulkPushRuleEvaluator(object): if matches: actions = [x for x in rule['actions'] if x != 'dont_notify'] if actions and 'notify' in actions: - # Push rules say we should notify the user of this event, - # so we mark it in the DB in the staging area. (This - # will then get handled when we persist the event) - yield self.store.add_push_actions_to_staging( - event.event_id, uid, actions, - ) + # Push rules say we should notify the user of this event + actions_by_user[uid] = actions break + # Mark in the DB staging area the push actions for users who should be + # notified for this event. (This will then get handled when we persist + # the event) + yield self.store.add_push_actions_to_staging( + event.event_id, actions_by_user, + ) + def _condition_checker(evaluator, conditions, uid, display_name, cache): for cond in conditions: |