summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-11-03 16:31:08 +0000
committerErik Johnston <erik@matrix.org>2015-11-03 16:31:08 +0000
commit97d792b28fd2b0a51ed5b491e3ca6968733df383 (patch)
tree28afa208c1a8077d322bd0420e59fca3203f02d6 /synapse
parentFix broken cache for getting retry times. This meant we retried remote destin... (diff)
downloadsynapse-97d792b28fd2b0a51ed5b491e3ca6968733df383.tar.xz
Don't rearrange transaction_queue
Diffstat (limited to 'synapse')
-rw-r--r--synapse/federation/transaction_queue.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py
index 2a7dd343f3..aac6f1c167 100644
--- a/synapse/federation/transaction_queue.py
+++ b/synapse/federation/transaction_queue.py
@@ -203,6 +203,17 @@ class TransactionQueue(object):
     @log_function
     def _attempt_new_transaction(self, destination):
         # list of (pending_pdu, deferred, order)
+        if destination in self.pending_transactions:
+            # XXX: pending_transactions can get stuck on by a never-ending
+            # request at which point pending_pdus_by_dest just keeps growing.
+            # we need application-layer timeouts of some flavour of these
+            # requests
+            logger.debug(
+                "TX [%s] Transaction already in progress",
+                destination
+            )
+            return
+
         pending_pdus = self.pending_pdus_by_dest.pop(destination, [])
         pending_edus = self.pending_edus_by_dest.pop(destination, [])
         pending_failures = self.pending_failures_by_dest.pop(destination, [])
@@ -215,18 +226,6 @@ class TransactionQueue(object):
             logger.debug("TX [%s] Nothing to send", destination)
             return
 
-        if destination in self.pending_transactions:
-            # XXX: pending_transactions can get stuck on by a never-ending
-            # request at which point pending_pdus_by_dest just keeps growing.
-            # we need application-layer timeouts of some flavour of these
-            # requests
-            logger.debug(
-                "TX [%s] Transaction already in progress",
-                destination
-            )
-            return
-
-        # NOTE: Nothing should be between the above check and the insertion below
         try:
             self.pending_transactions[destination] = 1