summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-07-13 11:44:49 +0100
committerGitHub <noreply@github.com>2017-07-13 11:44:48 +0100
commit67b7b904bae8a6c205694f11e1d1dd9f6c11be1d (patch)
treec70aa6cb4e7f7be1ff7c7e5721e8c09de0cbae94 /synapse
parentMerge pull request #2362 from matrix-org/erikj/sync_user_users_who_share (diff)
parentPush: Don't acquire lock unless necessary (diff)
downloadsynapse-67b7b904bae8a6c205694f11e1d1dd9f6c11be1d.tar.xz
Merge pull request #2365 from matrix-org/erikj/push_skip_lock
Push: Don't acquire lock unless necessary
Diffstat (limited to 'synapse')
-rw-r--r--synapse/push/bulk_push_rule_evaluator.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/push/bulk_push_rule_evaluator.py b/synapse/push/bulk_push_rule_evaluator.py
index 803ac3e75b..f304f4daf2 100644
--- a/synapse/push/bulk_push_rule_evaluator.py
+++ b/synapse/push/bulk_push_rule_evaluator.py
@@ -213,6 +213,10 @@ class RulesForRoom(object):
         """
         state_group = context.state_group
 
+        if state_group and self.state_group == state_group:
+            logger.debug("Using cached rules for %r", self.room_id)
+            defer.returnValue(self.rules_by_user)
+
         with (yield self.linearizer.queue(())):
             if state_group and self.state_group == state_group:
                 logger.debug("Using cached rules for %r", self.room_id)