diff options
author | Richard van der Hoff <richard@matrix.org> | 2020-02-03 15:48:33 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2020-02-03 15:48:33 +0000 |
commit | 1cdc253e0a965515823bc34c6223dbeda0c55669 (patch) | |
tree | e0a083e2d30efd204912cf0093d0b7be055b710c /synapse/handlers/federation.py | |
parent | make FederationHandler._handle_new_events async (diff) | |
download | synapse-1cdc253e0a965515823bc34c6223dbeda0c55669.tar.xz |
make FederationHandler._handle_new_event async
Diffstat (limited to '')
-rw-r--r-- | synapse/handlers/federation.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 9c16f54304..81eb7eecbd 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -1782,11 +1782,10 @@ class FederationHandler(BaseHandler): def get_min_depth_for_context(self, context): return self.store.get_min_depth(context) - @defer.inlineCallbacks - def _handle_new_event( + async def _handle_new_event( self, origin, event, state=None, auth_events=None, backfilled=False ): - context = yield self._prep_event( + context = await self._prep_event( origin, event, state=state, auth_events=auth_events, backfilled=backfilled ) @@ -1799,11 +1798,11 @@ class FederationHandler(BaseHandler): and not backfilled and not context.rejected ): - yield self.action_generator.handle_push_actions_for_event( + await self.action_generator.handle_push_actions_for_event( event, context ) - yield self.persist_events_and_notify( + await self.persist_events_and_notify( [(event, context)], backfilled=backfilled ) success = True @@ -2296,7 +2295,9 @@ class FederationHandler(BaseHandler): logger.debug( "do_auth %s missing_auth: %s", event.event_id, e.event_id ) - yield self._handle_new_event(origin, e, auth_events=auth) + yield defer.ensureDeferred( + self._handle_new_event(origin, e, auth_events=auth) + ) if e.event_id in event_auth_events: auth_events[(e.type, e.state_key)] = e |