0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-12 04:52:26 +01:00

Add measure blocks to notifier

This commit is contained in:
Erik Johnston 2016-08-19 17:33:12 +01:00
parent 290763f559
commit 39242090e3

View file

@ -20,6 +20,7 @@ from synapse.api.errors import AuthError
from synapse.util.logutils import log_function from synapse.util.logutils import log_function
from synapse.util.async import ObservableDeferred from synapse.util.async import ObservableDeferred
from synapse.util.logcontext import PreserveLoggingContext from synapse.util.logcontext import PreserveLoggingContext
from synapse.util.metrics import Measure
from synapse.types import StreamToken from synapse.types import StreamToken
from synapse.visibility import filter_events_for_client from synapse.visibility import filter_events_for_client
import synapse.metrics import synapse.metrics
@ -231,6 +232,7 @@ class Notifier(object):
Will wake up all listeners for the given users and rooms. Will wake up all listeners for the given users and rooms.
""" """
with PreserveLoggingContext(): with PreserveLoggingContext():
with Measure(self.clock, "on_new_event"):
user_streams = set() user_streams = set()
for user in users: for user in users:
@ -254,6 +256,7 @@ class Notifier(object):
"""Used to inform replication listeners that something has happend """Used to inform replication listeners that something has happend
without waking up any of the normal user event streams""" without waking up any of the normal user event streams"""
with PreserveLoggingContext(): with PreserveLoggingContext():
with Measure(self.clock, "on_new_replication_data"):
self.notify_replication() self.notify_replication()
@defer.inlineCallbacks @defer.inlineCallbacks