summary refs log tree commit diff
diff options
context:
space:
mode:
authorJason Little <realtyem@gmail.com>2023-11-22 04:59:16 -0600
committerGitHub <noreply@github.com>2023-11-22 10:59:16 +0000
commit460743da16da5df041b135ba607404bc71f29341 (patch)
tree74778416ee756e96e3750b79680d46b00443398c
parentMerge branch 'release-v1.97' into develop (diff)
downloadsynapse-460743da16da5df041b135ba607404bc71f29341.tar.xz
Filter out auth chain queries that don't exist (#16552)
-rw-r--r--changelog.d/16552.misc1
-rw-r--r--synapse/storage/databases/main/event_federation.py5
2 files changed, 6 insertions, 0 deletions
diff --git a/changelog.d/16552.misc b/changelog.d/16552.misc
new file mode 100644

index 0000000000..73a0376df0 --- /dev/null +++ b/changelog.d/16552.misc
@@ -0,0 +1 @@ +Reduce a little database load while processing state auth chains. diff --git a/synapse/storage/databases/main/event_federation.py b/synapse/storage/databases/main/event_federation.py
index 7e992ca4a2..d5fb6ecc73 100644 --- a/synapse/storage/databases/main/event_federation.py +++ b/synapse/storage/databases/main/event_federation.py
@@ -301,6 +301,11 @@ class EventFederationWorkerStore(SignatureWorkerStore, EventsWorkerStore, SQLBas # 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