Fix timeout function

Turns out deferred.cancel sometimes throws, so we do that last to ensure
that we always do resolve the new deferred.
This commit is contained in:
Erik Johnston 2018-09-15 11:38:39 +01:00
parent c30cfff572
commit 24efb2a70d
1 changed files with 2 additions and 1 deletions

View File

@ -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):