@@ -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 ()
@@ -814,6 +815,9 @@ async def backfill(self, dest, room_id, limit, extremities):
814
815
dest , room_id , limit = limit , extremities = extremities
815
816
)
816
817
818
+ if not events :
819
+ return []
820
+
817
821
# ideally we'd sanity check the events here for excess prev_events etc,
818
822
# but it's hard to reject events at this point without completely
819
823
# breaking backfill in the same way that it is currently broken by
@@ -2164,10 +2168,10 @@ async def _check_for_soft_fail(
2164
2168
# given state at the event. This should correctly handle cases
2165
2169
# like bans, especially with state res v2.
2166
2170
2167
- state_sets = await self .state_store .get_state_groups (
2171
+ state_sets_d = await self .state_store .get_state_groups (
2168
2172
event .room_id , extrem_ids
2169
2173
)
2170
- state_sets = list (state_sets .values ())
2174
+ state_sets = list (state_sets_d .values ()) # type: List[Iterable[EventBase]]
2171
2175
state_sets .append (state )
2172
2176
current_states = await self .state_handler .resolve_events (
2173
2177
room_version , state_sets , event
@@ -2958,6 +2962,7 @@ async def persist_events_and_notify(
2958
2962
)
2959
2963
return result ["max_stream_id" ]
2960
2964
else :
2965
+ assert self .storage .persistence
2961
2966
max_stream_token = await self .storage .persistence .persist_events (
2962
2967
event_and_contexts , backfilled = backfilled
2963
2968
)
0 commit comments