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

Commit 8eca8c9

Browse files
committed
Push down min_depth read
No point reading it from the database unless we're going to use it.
1 parent a1441dd commit 8eca8c9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

synapse/handlers/federation.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,15 @@ async def on_receive_pdu(
285285
# - Fetching any missing prev events to fill in gaps in the graph
286286
# - Fetching state if we have a hole in the graph
287287
if not pdu.internal_metadata.is_outlier():
288-
# We only backfill backwards to the min depth.
289-
min_depth = await self.get_min_depth_for_context(pdu.room_id)
290-
291-
logger.debug("min_depth: %d", min_depth)
292-
293288
prevs = set(pdu.prev_event_ids())
294289
seen = await self.store.have_events_in_timeline(prevs)
295290
missing_prevs = prevs - seen
296291

297292
if sent_to_us_directly:
293+
# We only backfill backwards to the min depth.
294+
min_depth = await self.get_min_depth_for_context(pdu.room_id)
295+
logger.debug("min_depth: %d", min_depth)
296+
298297
if missing_prevs and min_depth is not None and pdu.depth > min_depth:
299298
# If we're missing stuff, ensure we only fetch stuff one
300299
# at a time.

0 commit comments

Comments
 (0)