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

Commit

Permalink
Filter out auth chain queries that don't exist (#16552)
Browse files Browse the repository at this point in the history
  • Loading branch information
realtyem committed Nov 22, 2023
1 parent 8d5c1fe commit 460743d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/16552.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reduce a little database load while processing state auth chains.
5 changes: 5 additions & 0 deletions synapse/storage/databases/main/event_federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ def _get_auth_chain_ids_using_cover_index_txn(
# Add the initial set of chains, excluding the sequence corresponding to
# initial event.
for chain_id, seq_no in event_chains.items():
# Check if the initial event is the first item in the chain. If so, then
# there is nothing new to add from this chain.
if seq_no == 1:
continue

chains[chain_id] = max(seq_no - 1, chains.get(chain_id, 0))

# Now for each chain we figure out the maximum sequence number reachable
Expand Down

0 comments on commit 460743d

Please sign in to comment.