Bump batch size from 50 to 1000 for _get_e2e_cross_signing_signatures_for_devices query (#18939)

Co-authored-by: Eric Eastwood <erice@element.io>
This commit is contained in:
Andrew Morgan
2025-09-23 15:47:29 +01:00
committed by GitHub
parent ddc7627b22
commit 9ed0d36fe2
2 changed files with 5 additions and 1 deletions

1
changelog.d/18939.misc Normal file
View File

@@ -0,0 +1 @@
Reduce overall number of calls to `_get_e2e_cross_signing_signatures_for_devices` by increasing the batch size of devices the query is called with, reducing DB load.

View File

@@ -354,7 +354,10 @@ class EndToEndKeyWorkerStore(EndToEndKeyBackgroundStore, CacheInvalidationWorker
if d is not None and d.keys is not None
)
for batch in batch_iter(signature_query, 50):
# 1000 is an arbitrary batch size. It helped performance on a very
# large-scale deployment (matrix.org), but has not been tested against
# any other setup.
for batch in batch_iter(signature_query, 1000):
cross_sigs_result = (
await self._get_e2e_cross_signing_signatures_for_devices(batch)
)