mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-08 00:15:10 -04:00
Mypy fixes for synapse.handlers.federation
(#8422)
For some reason, an apparently unrelated PR upset mypy about this module. Here are a number of little fixes.
This commit is contained in:
parent
12f0d18611
commit
2649d545a5
6 changed files with 19 additions and 11 deletions
|
@ -155,8 +155,9 @@ class FederationHandler(BaseHandler):
|
|||
self._device_list_updater = hs.get_device_handler().device_list_updater
|
||||
self._maybe_store_room_on_invite = self.store.maybe_store_room_on_invite
|
||||
|
||||
# When joining a room we need to queue any events for that room up
|
||||
self.room_queues = {}
|
||||
# When joining a room we need to queue any events for that room up.
|
||||
# For each room, a list of (pdu, origin) tuples.
|
||||
self.room_queues = {} # type: Dict[str, List[Tuple[EventBase, str]]]
|
||||
self._room_pdu_linearizer = Linearizer("fed_room_pdu")
|
||||
|
||||
self.third_party_event_rules = hs.get_third_party_event_rules()
|
||||
|
@ -814,6 +815,9 @@ class FederationHandler(BaseHandler):
|
|||
dest, room_id, limit=limit, extremities=extremities
|
||||
)
|
||||
|
||||
if not events:
|
||||
return []
|
||||
|
||||
# ideally we'd sanity check the events here for excess prev_events etc,
|
||||
# but it's hard to reject events at this point without completely
|
||||
# breaking backfill in the same way that it is currently broken by
|
||||
|
@ -2164,10 +2168,10 @@ class FederationHandler(BaseHandler):
|
|||
# given state at the event. This should correctly handle cases
|
||||
# like bans, especially with state res v2.
|
||||
|
||||
state_sets = await self.state_store.get_state_groups(
|
||||
state_sets_d = await self.state_store.get_state_groups(
|
||||
event.room_id, extrem_ids
|
||||
)
|
||||
state_sets = list(state_sets.values())
|
||||
state_sets = list(state_sets_d.values()) # type: List[Iterable[EventBase]]
|
||||
state_sets.append(state)
|
||||
current_states = await self.state_handler.resolve_events(
|
||||
room_version, state_sets, event
|
||||
|
@ -2958,6 +2962,7 @@ class FederationHandler(BaseHandler):
|
|||
)
|
||||
return result["max_stream_id"]
|
||||
else:
|
||||
assert self.storage.persistence
|
||||
max_stream_token = await self.storage.persistence.persist_events(
|
||||
event_and_contexts, backfilled=backfilled
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue