From 84dbc43ce190397cab4be6c9fc38f59eaa190248 Mon Sep 17 00:00:00 2001 From: reivilibre <38398653+reivilibre@users.noreply.github.com> Date: Wed, 26 Aug 2020 20:13:15 +0100 Subject: [PATCH] Apply suggestions from Rich's code review Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --- synapse/federation/sender/__init__.py | 2 +- synapse/federation/sender/per_destination_queue.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/synapse/federation/sender/__init__.py b/synapse/federation/sender/__init__.py index d71ef966f8..e9d66a6a7b 100644 --- a/synapse/federation/sender/__init__.py +++ b/synapse/federation/sender/__init__.py @@ -285,7 +285,7 @@ class FederationSender(object): sent_pdus_destination_dist_total.inc(len(destinations)) sent_pdus_destination_dist_count.inc() - # track the fact that we are enqueuing this PDU for these destinations, + # track the fact that we have a PDU for these destinations, # to allow us to perform catch-up later on if the remote is unreachable # for a while. await self.store.store_destination_rooms_entries( diff --git a/synapse/federation/sender/per_destination_queue.py b/synapse/federation/sender/per_destination_queue.py index c23365d1f8..a2497ad99d 100644 --- a/synapse/federation/sender/per_destination_queue.py +++ b/synapse/federation/sender/per_destination_queue.py @@ -97,9 +97,11 @@ class PerDestinationQueue(object): # New events will only be sent once this is finished, at which point # _catching_up is flipped to False. self._catching_up = True + # the maximum stream order to catch up to (PDUs after this are expected # to be in the main transmission queue), inclusive self._catch_up_max_stream_order = None # type: Optional[int] + # Cache of the last successfully-transmitted stream ordering for this # destination (we are the only updater so this is safe) self._last_successful_stream_order = None # type: Optional[int] @@ -152,7 +154,7 @@ class PerDestinationQueue(object): order: an arbitrary order for the PDU — NOT the stream ordering """ if ( - self._catch_up_max_stream_order + self._catch_up_max_stream_order is not None and pdu.internal_metadata.stream_ordering <= self._catch_up_max_stream_order ): # we are in catch-up mode and this PDU is already scheduled to be