diff options
author | Krombel <krombel@krombel.de> | 2017-06-21 14:48:21 +0200 |
---|---|---|
committer | Krombel <krombel@krombel.de> | 2017-06-21 14:48:21 +0200 |
commit | 4202fba82a255eb52783a91d873b91aa8ef2191c (patch) | |
tree | 73975e960b5a80f7a466cbf62810639662093d4a /synapse/push/action_generator.py | |
parent | replaced json.dumps with encode_canonical_json (diff) | |
parent | Merge pull request #2292 from matrix-org/erikj/quarantine_media (diff) | |
download | synapse-4202fba82a255eb52783a91d873b91aa8ef2191c.tar.xz |
Merge branch 'develop' into avoid_duplicate_filters
Diffstat (limited to 'synapse/push/action_generator.py')
-rw-r--r-- | synapse/push/action_generator.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/synapse/push/action_generator.py b/synapse/push/action_generator.py index 3f75d3f921..fe09d50d55 100644 --- a/synapse/push/action_generator.py +++ b/synapse/push/action_generator.py @@ -15,7 +15,7 @@ from twisted.internet import defer -from .bulk_push_rule_evaluator import evaluator_for_event +from .bulk_push_rule_evaluator import BulkPushRuleEvaluator from synapse.util.metrics import Measure @@ -24,11 +24,12 @@ import logging logger = logging.getLogger(__name__) -class ActionGenerator: +class ActionGenerator(object): def __init__(self, hs): self.hs = hs self.clock = hs.get_clock() self.store = hs.get_datastore() + self.bulk_evaluator = BulkPushRuleEvaluator(hs) # really we want to get all user ids and all profile tags too, # since we want the actions for each profile tag for every user and # also actions for a client with no profile tag for each user. @@ -38,16 +39,11 @@ class ActionGenerator: @defer.inlineCallbacks def handle_push_actions_for_event(self, event, context): - with Measure(self.clock, "evaluator_for_event"): - bulk_evaluator = yield evaluator_for_event( - event, self.hs, self.store, context - ) - with Measure(self.clock, "action_for_event_by_user"): - actions_by_user = yield bulk_evaluator.action_for_event_by_user( + actions_by_user = yield self.bulk_evaluator.action_for_event_by_user( event, context ) context.push_actions = [ - (uid, actions) for uid, actions in actions_by_user.items() + (uid, actions) for uid, actions in actions_by_user.iteritems() ] |