Merge pull request #2365 from matrix-org/erikj/push_skip_lock

Push: Don't acquire lock unless necessary
This commit is contained in:
Erik Johnston 2017-07-13 11:44:49 +01:00 committed by GitHub
commit 67b7b904ba
1 changed files with 4 additions and 0 deletions

View File

@ -213,6 +213,10 @@ class RulesForRoom(object):
""" """
state_group = context.state_group 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(())): with (yield self.linearizer.queue(())):
if state_group and self.state_group == state_group: if state_group and self.state_group == state_group:
logger.debug("Using cached rules for %r", self.room_id) logger.debug("Using cached rules for %r", self.room_id)