From 16eec5cbfa3ac42982f138efa7d56dcad8204c38 Mon Sep 17 00:00:00 2001 From: "Olivier Wilkinson (reivilibre)" Date: Wed, 26 Aug 2020 20:49:50 +0100 Subject: [PATCH] The early bird gets the early return (hopefully with a worm as the return value) --- .../sender/per_destination_queue.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/synapse/federation/sender/per_destination_queue.py b/synapse/federation/sender/per_destination_queue.py index ad83db36bb..c36ec280f5 100644 --- a/synapse/federation/sender/per_destination_queue.py +++ b/synapse/federation/sender/per_destination_queue.py @@ -518,18 +518,19 @@ class PerDestinationQueue(object): success = await self._transaction_manager.send_new_transaction( self._destination, catch_up_pdus, [] ) - if success: - sent_transactions_counter.inc() - final_pdu, _ = catch_up_pdus[-1] - self._last_successful_stream_order = cast( - int, final_pdu.internal_metadata.stream_ordering - ) - await self._store.set_last_successful_stream_ordering( - self._destination, self._last_successful_stream_order - ) - else: + + if not success: return + sent_transactions_counter.inc() + final_pdu, _ = catch_up_pdus[-1] + self._last_successful_stream_order = cast( + int, final_pdu.internal_metadata.stream_ordering + ) + await self._store.set_last_successful_stream_ordering( + self._destination, self._last_successful_stream_order + ) + # once we have reached this point, catch-up is done! self._catching_up = False