diff options
author | Erik Johnston <erik@matrix.org> | 2019-05-09 13:21:57 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-05-14 11:58:01 +0100 |
commit | b54b03f9e1abc1964fe5f00115a165a2b8e10df5 (patch) | |
tree | bb2a357af902fbdfa935da416a6beaedbd5c8a02 /synapse/handlers/events.py | |
parent | Migrate all tests to use the dict-based config format instead of hanging item... (diff) | |
download | synapse-b54b03f9e1abc1964fe5f00115a165a2b8e10df5.tar.xz |
Allow client event serialization to be async
Diffstat (limited to 'synapse/handlers/events.py')
-rw-r--r-- | synapse/handlers/events.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/handlers/events.py b/synapse/handlers/events.py index 1b4d8c74ae..6003ad9cca 100644 --- a/synapse/handlers/events.py +++ b/synapse/handlers/events.py @@ -21,7 +21,6 @@ from twisted.internet import defer from synapse.api.constants import EventTypes, Membership from synapse.api.errors import AuthError, SynapseError from synapse.events import EventBase -from synapse.events.utils import serialize_event from synapse.types import UserID from synapse.util.logutils import log_function from synapse.visibility import filter_events_for_client @@ -50,6 +49,7 @@ class EventStreamHandler(BaseHandler): self.notifier = hs.get_notifier() self.state = hs.get_state_handler() self._server_notices_sender = hs.get_server_notices_sender() + self._event_serializer = hs.get_event_client_serializer() @defer.inlineCallbacks @log_function @@ -120,9 +120,9 @@ class EventStreamHandler(BaseHandler): time_now = self.clock.time_msec() - chunks = [ - serialize_event(e, time_now, as_client_event) for e in events - ] + chunks = yield self._event_serializer.serialize_events( + events, time_now, as_client_event=as_client_event, + ) chunk = { "chunk": chunks, |