1
0

Apply suggestions from Rich's code review

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
reivilibre
2020-08-26 20:13:15 +01:00
committed by GitHub
parent 56aaa17c8e
commit 84dbc43ce1
2 changed files with 4 additions and 2 deletions

View File

@@ -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(

View File

@@ -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