@@ -155,8 +155,9 @@ def __init__(self, hs):
155
155
self ._device_list_updater = hs .get_device_handler ().device_list_updater
156
156
self ._maybe_store_room_on_invite = self .store .maybe_store_room_on_invite
157
157
158
- # When joining a room we need to queue any events for that room up
159
- self .room_queues = {}
158
+ # When joining a room we need to queue any events for that room up.
159
+ # For each room, a list of (pdu, origin) tuples.
160
+ self .room_queues = {} # type: Dict[str, List[Tuple[EventBase, str]]]
160
161
self ._room_pdu_linearizer = Linearizer ("fed_room_pdu" )
161
162
162
163
self .third_party_event_rules = hs .get_third_party_event_rules ()
@@ -817,6 +818,9 @@ async def backfill(self, dest, room_id, limit, extremities):
817
818
dest , room_id , limit = limit , extremities = extremities
818
819
)
819
820
821
+ if not events :
822
+ return []
823
+
820
824
# ideally we'd sanity check the events here for excess prev_events etc,
821
825
# but it's hard to reject events at this point without completely
822
826
# breaking backfill in the same way that it is currently broken by
@@ -2174,10 +2178,10 @@ async def _check_for_soft_fail(
2174
2178
# given state at the event. This should correctly handle cases
2175
2179
# like bans, especially with state res v2.
2176
2180
2177
- state_sets = await self .state_store .get_state_groups (
2181
+ state_sets_d = await self .state_store .get_state_groups (
2178
2182
event .room_id , extrem_ids
2179
2183
)
2180
- state_sets = list (state_sets .values ())
2184
+ state_sets = list (state_sets_d .values ()) # type: List[Iterable[EventBase]]
2181
2185
state_sets .append (state )
2182
2186
current_states = await self .state_handler .resolve_events (
2183
2187
room_version , state_sets , event
@@ -2968,6 +2972,7 @@ async def persist_events_and_notify(
2968
2972
)
2969
2973
return result ["max_stream_id" ]
2970
2974
else :
2975
+ assert self .storage .persistence
2971
2976
max_stream_token = await self .storage .persistence .persist_events (
2972
2977
event_and_contexts , backfilled = backfilled
2973
2978
)
0 commit comments