make FederationHandler.do_auth async

This commit is contained in:
Richard van der Hoff 2020-02-03 15:51:24 +00:00
parent 8033b257a7
commit bc9b75c6f0
1 changed files with 14 additions and 10 deletions

View File

@ -2149,16 +2149,20 @@ class FederationHandler(BaseHandler):
return missing_events
@defer.inlineCallbacks
@log_function
def do_auth(self, origin, event, context, auth_events):
async def do_auth(
self,
origin: str,
event: EventBase,
context: EventContext,
auth_events: StateMap[EventBase],
) -> EventContext:
"""
Args:
origin (str):
event (synapse.events.EventBase):
context (synapse.events.snapshot.EventContext):
auth_events (dict[(str, str)->synapse.events.EventBase]):
origin:
event:
context:
auth_events:
Map from (event_type, state_key) to event
Normally, our calculated auth_events based on the state of the room
@ -2168,13 +2172,13 @@ class FederationHandler(BaseHandler):
Also NB that this function adds entries to it.
Returns:
defer.Deferred[EventContext]: updated context object
updated context object
"""
room_version = yield self.store.get_room_version_id(event.room_id)
room_version = await self.store.get_room_version_id(event.room_id)
room_version_obj = KNOWN_ROOM_VERSIONS[room_version]
try:
context = yield self._update_auth_events_and_context_for_auth(
context = await self._update_auth_events_and_context_for_auth(
origin, event, context, auth_events
)
except Exception: