diff options
author | Eric Eastwood <erice@element.io> | 2022-02-04 16:05:57 -0600 |
---|---|---|
committer | Eric Eastwood <erice@element.io> | 2022-02-04 16:05:57 -0600 |
commit | a38befa07b24076cbe14ee40a2efb38219f94cc9 (patch) | |
tree | ec5c73838b1ebd9c740316b3982795bca88c7032 | |
parent | Merge branch 'develop' into madlittlemods/return-historical-events-in-order-f... (diff) | |
download | synapse-a38befa07b24076cbe14ee40a2efb38219f94cc9.tar.xz |
Some review optimizations
See: - https://github.com/matrix-org/synapse/pull/11114#discussion_r799350801 - https://github.com/matrix-org/synapse/pull/11114#discussion_r799354680
-rw-r--r-- | synapse/storage/databases/main/event_federation.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/storage/databases/main/event_federation.py b/synapse/storage/databases/main/event_federation.py index ec2629e657..80c22e4a81 100644 --- a/synapse/storage/databases/main/event_federation.py +++ b/synapse/storage/databases/main/event_federation.py @@ -13,6 +13,7 @@ # limitations under the License. import itertools import logging +import attr from queue import Empty, PriorityQueue from typing import ( TYPE_CHECKING, @@ -71,7 +72,8 @@ logger = logging.getLogger(__name__) # All the info we need while iterating the DAG while backfilling -class BackfillQueueNavigationItem(NamedTuple): +@attr.s(frozen=True, slots=True, auto_attribs=True) +class BackfillQueueNavigationItem: depth: int stream_ordering: int event_id: str @@ -1051,7 +1053,6 @@ class EventFederationWorkerStore(SignatureWorkerStore, EventsWorkerStore, SQLBas batch_connection_query, (insertion_event_id, limit), ) - batch_start_event_id_results = txn.fetchall() return [ BackfillQueueNavigationItem( depth=row[0], @@ -1059,7 +1060,7 @@ class EventFederationWorkerStore(SignatureWorkerStore, EventsWorkerStore, SQLBas event_id=row[2], type=row[3], ) - for row in batch_start_event_id_results + for row in txn ] def _get_connected_prev_event_backfill_results_txn( |