summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
Diffstat (limited to 'synapse')
-rw-r--r--synapse/util/async_helpers.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/util/async_helpers.py b/synapse/util/async_helpers.py
index 083e4f4128..40c2946129 100644
--- a/synapse/util/async_helpers.py
+++ b/synapse/util/async_helpers.py
@@ -456,11 +456,12 @@ def timeout_no_seriously(deferred, timeout, reactor):
 
     def time_it_out():
         timed_out[0] = True
-        deferred.cancel()
 
         if not new_d.called:
             new_d.errback(DeferredTimeoutError(timeout, "Deferred"))
 
+        deferred.cancel()
+
     delayed_call = reactor.callLater(timeout, time_it_out)
 
     def convert_cancelled(value):