Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Backfill in the background if we're doing it "just because" #15702

@MadLittleMods

Description

@MadLittleMods

With Synapse currently, if you're paginating in a section of timeline back in time without any backward extremities, Synapse will still try to backfill any backward extremities that come later in the room (where you're not even viewing). This is fine from a eventual consistency perspective but is unlikely that the extra /backfill will reveal any new messages to return in the /messages request that triggered it in the first place.

Instead of doing this in the foreground which causes unnecessary delay for the user, we can just do this in the background.

# If we have no backfill points lower than the `current_depth` then
# either we can a) bail or b) still attempt to backfill. We opt to try
# backfilling anyway just in case we do get relevant events.
if not sorted_backfill_points and current_depth != MAX_DEPTH:
logger.debug(
"_maybe_backfill_inner: all backfill points are *after* current depth. Trying again with later backfill points."
)

I completely acknowledge that a backward extremity later in the DAG, could connect to an unknown branch in the DAG that has events at the depth we're scrolling through but how likely is this to happen? This would be an interesting metric to track (how many events from /backfill actually end up in /messages)

Metadata

Metadata

Assignees

Labels

A-FederationA-Messages-Endpoint/messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill)A-PerformancePerformance, both client-facing and admin-facingO-OccasionalAffects or can be seen by some users regularly or most users rarelyS-MinorBlocks non-critical functionality, workarounds exist.T-EnhancementNew features, changes in functionality, improvements in performance, or user-facing enhancements.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions