diff options
author | Erik Johnston <erik@matrix.org> | 2018-09-15 11:38:39 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2018-09-15 11:38:39 +0100 |
commit | 24efb2a70dfd8aa100507612836601991e11affc (patch) | |
tree | 82cfeb094e629a818d2c66ff35d3e5ba514ec5bc /synapse/util/async_helpers.py | |
parent | Merge pull request #3875 from matrix-org/erikj/extra_timeouts (diff) | |
download | synapse-24efb2a70dfd8aa100507612836601991e11affc.tar.xz |
Fix timeout function
Turns out deferred.cancel sometimes throws, so we do that last to ensure that we always do resolve the new deferred.
Diffstat (limited to 'synapse/util/async_helpers.py')
-rw-r--r-- | synapse/util/async_helpers.py | 3 |
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): |