summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-18 12:03:12 +0000
committerErik Johnston <erik@matrix.org>2015-02-18 12:03:26 +0000
commit446ef589920a9c3c4738873023494bed79d1f6c3 (patch)
tree2b0425ca39f0c348744bf407f9dac0bc48594746
parentRemove unused import (diff)
downloadsynapse-446ef589920a9c3c4738873023494bed79d1f6c3.tar.xz
Add errback to all deferreds in transaction_queue
-rw-r--r--synapse/federation/transaction_queue.py37
1 files changed, 23 insertions, 14 deletions
diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py
index 06944eefb9..1e5505a4bf 100644
--- a/synapse/federation/transaction_queue.py
+++ b/synapse/federation/transaction_queue.py
@@ -90,14 +90,17 @@ class TransactionQueue(object):
                 (pdu, deferred, order)
             )
 
-            def eb(failure):
+            def chain(failure):
                 if not deferred.called:
                     deferred.errback(failure)
-                else:
-                    logger.warn("Failed to send pdu", failure.value)
+
+            def log_failure(failure):
+                logger.warn("Failed to send pdu", failure.value)
+
+            deferred.addErrback(log_failure)
 
             with PreserveLoggingContext():
-                self._attempt_new_transaction(destination).addErrback(eb)
+                self._attempt_new_transaction(destination).addErrback(chain)
 
             deferreds.append(deferred)
 
@@ -115,14 +118,17 @@ class TransactionQueue(object):
             (edu, deferred)
         )
 
-        def eb(failure):
+        def chain(failure):
             if not deferred.called:
                 deferred.errback(failure)
-            else:
-                logger.warn("Failed to send edu", failure.value)
+
+        def log_failure(failure):
+            logger.warn("Failed to send pdu", failure.value)
+
+        deferred.addErrback(log_failure)
 
         with PreserveLoggingContext():
-            self._attempt_new_transaction(destination).addErrback(eb)
+            self._attempt_new_transaction(destination).addErrback(chain)
 
         return deferred
 
@@ -139,14 +145,17 @@ class TransactionQueue(object):
             (failure, deferred)
         )
 
-        def eb(failure):
+        def chain(f):
             if not deferred.called:
-                deferred.errback(failure)
-            else:
-                logger.warn("Failed to send failure", failure.value)
+                deferred.errback(f)
+
+        def log_failure(f):
+            logger.warn("Failed to send pdu", f.value)
+
+        deferred.addErrback(log_failure)
 
         with PreserveLoggingContext():
-            self._attempt_new_transaction(destination).addErrback(eb)
+            self._attempt_new_transaction(destination).addErrback(chain)
 
         yield deferred
 
@@ -308,7 +317,7 @@ class TransactionQueue(object):
         except Exception as e:
             # We capture this here as there as nothing actually listens
             # for this finishing functions deferred.
-            logger.exception(
+            logger.warn(
                 "TX [%s] Problem in _attempt_transaction: %s",
                 destination,
                 e,