diff options
author | Erik Johnston <erik@matrix.org> | 2016-04-14 13:49:09 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-04-14 13:49:09 +0100 |
commit | 5a578ea4c7effc13189eb4c10436cbed66f732ec (patch) | |
tree | 9c152015405fca040c9a6f4c091062279593c56e /synapse | |
parent | Merge pull request #725 from matrix-org/dbkr/push_only_joined (diff) | |
parent | Measure push action generator (diff) | |
download | synapse-5a578ea4c7effc13189eb4c10436cbed66f732ec.tar.xz |
Merge pull request #726 from matrix-org/erikj/push_metric
Measure push action generator
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/push/action_generator.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/synapse/push/action_generator.py b/synapse/push/action_generator.py index 59e512f507..a0160994b7 100644 --- a/synapse/push/action_generator.py +++ b/synapse/push/action_generator.py @@ -17,6 +17,8 @@ from twisted.internet import defer from .bulk_push_rule_evaluator import evaluator_for_event +from synapse.util.metrics import Measure + import logging logger = logging.getLogger(__name__) @@ -25,6 +27,7 @@ logger = logging.getLogger(__name__) class ActionGenerator: def __init__(self, hs): self.hs = hs + self.clock = hs.get_clock() self.store = hs.get_datastore() # 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 @@ -35,14 +38,15 @@ class ActionGenerator: @defer.inlineCallbacks def handle_push_actions_for_event(self, event, context, handler): - bulk_evaluator = yield evaluator_for_event( - event, self.hs, self.store - ) - - actions_by_user = yield bulk_evaluator.action_for_event_by_user( - event, handler, context.current_state - ) - - context.push_actions = [ - (uid, actions) for uid, actions in actions_by_user.items() - ] + with Measure(self.clock, "handle_push_actions_for_event"): + bulk_evaluator = yield evaluator_for_event( + event, self.hs, self.store + ) + + actions_by_user = yield bulk_evaluator.action_for_event_by_user( + event, handler, context.current_state + ) + + context.push_actions = [ + (uid, actions) for uid, actions in actions_by_user.items() + ] |