From 44765e95104e5eea7d6867f00c5deb12c9684de5 Mon Sep 17 00:00:00 2001 From: "Olivier Wilkinson (reivilibre)" Date: Thu, 20 Aug 2020 10:28:16 +0100 Subject: [PATCH] How could we ever forget you, ./scripts-dev/lint.sh? --- synapse/federation/sender/per_destination_queue.py | 4 +--- synapse/storage/databases/main/transactions.py | 11 +++++++---- tests/federation/test_federation_catch_up.py | 5 +++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/synapse/federation/sender/per_destination_queue.py b/synapse/federation/sender/per_destination_queue.py index 1cc44bd915..c23365d1f8 100644 --- a/synapse/federation/sender/per_destination_queue.py +++ b/synapse/federation/sender/per_destination_queue.py @@ -504,9 +504,7 @@ class PerDestinationQueue(object): # of redacted events to the destination. # - don't need to worry about rejected events as we do not actively # forward received events over federation. - events = await self._store.get_events_as_list( - event_ids - ) + events = await self._store.get_events_as_list(event_ids) # zip them together with their stream orderings catch_up_pdus = [ diff --git a/synapse/storage/databases/main/transactions.py b/synapse/storage/databases/main/transactions.py index 0b8b04a9ab..6c6f51cdd0 100644 --- a/synapse/storage/databases/main/transactions.py +++ b/synapse/storage/databases/main/transactions.py @@ -14,14 +14,13 @@ # limitations under the License. import logging from collections import namedtuple -from typing import List, Optional, Iterable +from typing import Iterable, List, Optional from canonicaljson import encode_canonical_json from synapse.metrics.background_process_metrics import run_as_background_process from synapse.storage._base import SQLBaseStore, db_to_json from synapse.storage.database import DatabasePool -from synapse.types import Collection from synapse.util.caches.expiringcache import ExpiringCache db_binary_type = memoryview @@ -266,7 +265,9 @@ class TransactionStore(SQLBaseStore): "_cleanup_transactions", _cleanup_transactions_txn ) - async def get_last_successful_stream_ordering(self, destination: str) -> Optional[int]: + async def get_last_successful_stream_ordering( + self, destination: str + ) -> Optional[int]: """ Gets the stream ordering of the PDU most-recently successfully sent to the specified destination. @@ -350,7 +351,9 @@ class TransactionStore(SQLBaseStore): event_ids = [row[0] for row in txn] return event_ids - async def get_largest_destination_rooms_stream_order(self, destination: str) -> Optional[int]: + async def get_largest_destination_rooms_stream_order( + self, destination: str + ) -> Optional[int]: """ Returns the largest stream_ordering from the destination_rooms table that corresponds to this destination. diff --git a/tests/federation/test_federation_catch_up.py b/tests/federation/test_federation_catch_up.py index c70fc9cc2f..1d4cbcfab1 100644 --- a/tests/federation/test_federation_catch_up.py +++ b/tests/federation/test_federation_catch_up.py @@ -1,4 +1,3 @@ -from asyncio.futures import Future from typing import List, Tuple from mock import Mock @@ -32,7 +31,9 @@ class FederationCatchUpTestCases(FederatingHomeserverTestCase): state_handler = hs.get_state_handler() # This mock is crucial for destination_rooms to be populated. - state_handler.get_current_hosts_in_room = Mock(return_value=make_awaitable(["test", "host2"])) + state_handler.get_current_hosts_in_room = Mock( + return_value=make_awaitable(["test", "host2"]) + ) # whenever send_transaction is called, record the pdu data self.pdus = []