summary refs log tree commit diff
path: root/synapse/util/retryutils.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-11-22 17:45:44 +0000
committerErik Johnston <erik@matrix.org>2016-11-22 17:45:44 +0000
commit90565d015e97a494f516cc6f06596ca5c6d490ec (patch)
tree77e37de19c6476bf5b9312168b06e74347e005db /synapse/util/retryutils.py
parentComments (diff)
downloadsynapse-90565d015e97a494f516cc6f06596ca5c6d490ec.tar.xz
Invalidate retry cache in both directions
Diffstat (limited to '')
-rw-r--r--synapse/util/retryutils.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/synapse/util/retryutils.py b/synapse/util/retryutils.py
index 49527f4d21..46ef5a8ec7 100644
--- a/synapse/util/retryutils.py
+++ b/synapse/util/retryutils.py
@@ -121,12 +121,6 @@ class RetryDestinationLimiter(object):
         pass
 
     def __exit__(self, exc_type, exc_val, exc_tb):
-        def err(failure):
-            logger.exception(
-                "Failed to store set_destination_retry_timings",
-                failure.value
-            )
-
         valid_err_code = False
         if exc_type is not None and issubclass(exc_type, CodeMessageException):
             valid_err_code = 0 <= exc_val.code < 500
@@ -151,6 +145,15 @@ class RetryDestinationLimiter(object):
 
             retry_last_ts = int(self.clock.time_msec())
 
-        self.store.set_destination_retry_timings(
-            self.destination, retry_last_ts, self.retry_interval
-        ).addErrback(err)
+        @defer.inlineCallbacks
+        def store_retry_timings():
+            try:
+                yield self.store.set_destination_retry_timings(
+                    self.destination, retry_last_ts, self.retry_interval
+                )
+            except:
+                logger.exception(
+                    "Failed to store set_destination_retry_timings",
+                )
+
+        store_retry_timings()