Faster push rule calculation via push specific cache

We add a push rule specific cache that ensures that we can reuse
calculated push rules appropriately when a user join/leaves.
This commit is contained in:
Erik Johnston 2017-05-02 10:46:01 +01:00
parent ace23463c5
commit 66d8ffabbd
3 changed files with 249 additions and 47 deletions

View file

@ -54,6 +54,8 @@ class MessageHandler(BaseHandler):
# This is to stop us from diverging history *too* much.
self.limiter = Limiter(max_count=5)
self.action_generator = ActionGenerator(self.hs)
@defer.inlineCallbacks
def purge_history(self, room_id, event_id):
event = yield self.store.get_event(event_id)
@ -590,8 +592,7 @@ class MessageHandler(BaseHandler):
"Changing the room create event is forbidden",
)
action_generator = ActionGenerator(self.hs)
yield action_generator.handle_push_actions_for_event(
yield self.action_generator.handle_push_actions_for_event(
event, context
)