mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-13 05:52:12 -04:00
Fix missing sync events during historical batch imports (#12319)
Discovered after much in-depth investigation in #12281. Closes: #12281 Closes: #3305 Signed off by: Nick Mills-Barrett nick@beeper.com
This commit is contained in:
parent
d24cd17820
commit
e3a49f4784
5 changed files with 162 additions and 19 deletions
|
@ -758,6 +758,32 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||
"get_room_event_before_stream_ordering", _f
|
||||
)
|
||||
|
||||
async def get_last_event_in_room_before_stream_ordering(
|
||||
self,
|
||||
room_id: str,
|
||||
end_token: RoomStreamToken,
|
||||
) -> Optional[EventBase]:
|
||||
"""Returns the last event in a room at or before a stream ordering
|
||||
|
||||
Args:
|
||||
room_id
|
||||
end_token: The token used to stream from
|
||||
|
||||
Returns:
|
||||
The most recent event.
|
||||
"""
|
||||
|
||||
last_row = await self.get_room_event_before_stream_ordering(
|
||||
room_id=room_id,
|
||||
stream_ordering=end_token.stream,
|
||||
)
|
||||
if last_row:
|
||||
_, _, event_id = last_row
|
||||
event = await self.get_event(event_id, get_prev_content=True)
|
||||
return event
|
||||
|
||||
return None
|
||||
|
||||
async def get_current_room_stream_token_for_room_id(
|
||||
self, room_id: Optional[str] = None
|
||||
) -> RoomStreamToken:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue