Merge remote-tracking branch 'origin/release-v1.101' into develop

This commit is contained in:
Erik Johnston 2024-02-09 10:52:35 +00:00
commit ea1b30940e
2 changed files with 3 additions and 2 deletions

1
changelog.d/16893.bugfix Normal file
View File

@ -0,0 +1 @@
Fix performance regression when fetching auth chains from the DB. Introduced in v1.100.0.

View File

@ -310,7 +310,7 @@ class EventFederationWorkerStore(SignatureWorkerStore, EventsWorkerStore, SQLBas
# Add all linked chains reachable from initial set of chains. # Add all linked chains reachable from initial set of chains.
chains_to_fetch = set(event_chains.keys()) chains_to_fetch = set(event_chains.keys())
while chains_to_fetch: while chains_to_fetch:
batch2 = tuple(itertools.islice(chains_to_fetch, 100)) batch2 = tuple(itertools.islice(chains_to_fetch, 1000))
chains_to_fetch.difference_update(batch2) chains_to_fetch.difference_update(batch2)
clause, args = make_in_list_sql_clause( clause, args = make_in_list_sql_clause(
txn.database_engine, "origin_chain_id", batch2 txn.database_engine, "origin_chain_id", batch2
@ -593,7 +593,7 @@ class EventFederationWorkerStore(SignatureWorkerStore, EventsWorkerStore, SQLBas
# the loop) # the loop)
chains_to_fetch = set(seen_chains) chains_to_fetch = set(seen_chains)
while chains_to_fetch: while chains_to_fetch:
batch2 = tuple(itertools.islice(chains_to_fetch, 100)) batch2 = tuple(itertools.islice(chains_to_fetch, 1000))
clause, args = make_in_list_sql_clause( clause, args = make_in_list_sql_clause(
txn.database_engine, "origin_chain_id", batch2 txn.database_engine, "origin_chain_id", batch2
) )