mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-08-06 11:14:14 -04:00
Intelligently select extremities used in backfill. (#8349)
Instead of just using the most recent extremities let's pick the ones that will give us results that the pagination request cares about, i.e. pick extremities only if they have a smaller depth than the pagination token. This is useful when we fail to backfill an extremity, as we no longer get stuck requesting that same extremity repeatedly.
This commit is contained in:
parent
9db4c1b175
commit
43f2b67e4d
4 changed files with 67 additions and 20 deletions
|
@ -362,9 +362,9 @@ class PaginationHandler:
|
|||
# if we're going backwards, we might need to backfill. This
|
||||
# requires that we have a topo token.
|
||||
if room_token.topological:
|
||||
max_topo = room_token.topological
|
||||
curr_topo = room_token.topological
|
||||
else:
|
||||
max_topo = await self.store.get_max_topological_token(
|
||||
curr_topo = await self.store.get_current_topological_token(
|
||||
room_id, room_token.stream
|
||||
)
|
||||
|
||||
|
@ -380,11 +380,11 @@ class PaginationHandler:
|
|||
leave_token = await self.store.get_topological_token_for_event(
|
||||
member_event_id
|
||||
)
|
||||
if RoomStreamToken.parse(leave_token).topological < max_topo:
|
||||
if RoomStreamToken.parse(leave_token).topological < curr_topo:
|
||||
source_config.from_key = str(leave_token)
|
||||
|
||||
await self.hs.get_handlers().federation_handler.maybe_backfill(
|
||||
room_id, max_topo
|
||||
room_id, curr_topo, limit=source_config.limit,
|
||||
)
|
||||
|
||||
events, next_key = await self.store.paginate_room_events(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue