-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Backfill in the background if we're doing it "just because" #15702
Description
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.
synapse/synapse/handlers/federation.py
Lines 306 to 312 in 874378c
# 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
)