mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Merge pull request #726 from matrix-org/erikj/push_metric
Measure push action generator
This commit is contained in:
commit
5a578ea4c7
@ -17,6 +17,8 @@ from twisted.internet import defer
|
|||||||
|
|
||||||
from .bulk_push_rule_evaluator import evaluator_for_event
|
from .bulk_push_rule_evaluator import evaluator_for_event
|
||||||
|
|
||||||
|
from synapse.util.metrics import Measure
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -25,6 +27,7 @@ logger = logging.getLogger(__name__)
|
|||||||
class ActionGenerator:
|
class ActionGenerator:
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
self.hs = hs
|
self.hs = hs
|
||||||
|
self.clock = hs.get_clock()
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
# really we want to get all user ids and all profile tags too,
|
# 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
|
# since we want the actions for each profile tag for every user and
|
||||||
@ -35,14 +38,15 @@ class ActionGenerator:
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def handle_push_actions_for_event(self, event, context, handler):
|
def handle_push_actions_for_event(self, event, context, handler):
|
||||||
bulk_evaluator = yield evaluator_for_event(
|
with Measure(self.clock, "handle_push_actions_for_event"):
|
||||||
event, self.hs, self.store
|
bulk_evaluator = yield evaluator_for_event(
|
||||||
)
|
event, self.hs, self.store
|
||||||
|
)
|
||||||
|
|
||||||
actions_by_user = yield bulk_evaluator.action_for_event_by_user(
|
actions_by_user = yield bulk_evaluator.action_for_event_by_user(
|
||||||
event, handler, context.current_state
|
event, handler, context.current_state
|
||||||
)
|
)
|
||||||
|
|
||||||
context.push_actions = [
|
context.push_actions = [
|
||||||
(uid, actions) for uid, actions in actions_by_user.items()
|
(uid, actions) for uid, actions in actions_by_user.items()
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user