From 38f5dadd1b4dc4b9c9728fbf72cc85a9d2ae828e Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Thu, 18 Dec 2025 12:22:51 +0000 Subject: [PATCH] Generate multiple IDs in single call --- synapse/storage/databases/main/sticky_events.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/synapse/storage/databases/main/sticky_events.py b/synapse/storage/databases/main/sticky_events.py index 5113d95cdb..d1252b40a4 100644 --- a/synapse/storage/databases/main/sticky_events.py +++ b/synapse/storage/databases/main/sticky_events.py @@ -540,10 +540,15 @@ class StickyEventsWorkerStore(StateGroupWorkerStore, CacheInvalidationWorkerStor self, txn: LoggingTransaction, passing_event_ids: set[str] ) -> None: # Update the sticky events table so we notify downstream of the change in soft-failure status - new_stream_ids: list[tuple[str, int]] = [ - (event_id, self._sticky_events_id_gen.get_next_txn(txn)) - for event_id in passing_event_ids - ] + new_stream_ids: list[tuple[str, int]] = list( + zip( + passing_event_ids, + self._sticky_events_id_gen.get_next_mult_txn( + txn, len(passing_event_ids) + ), + strict=True, + ) + ) self.db_pool.simple_update_many_txn( txn,