diff options
author | Erik Johnston <erik@matrix.org> | 2015-02-11 10:25:06 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-02-11 10:25:06 +0000 |
commit | dcf52469e821b3b2b69a0610c2c4f025a5aac68f (patch) | |
tree | ec7527eedb3de013c6ff2a34883e627df1890a09 /synapse/util/async.py | |
parent | Time out HTTP federation requests (diff) | |
download | synapse-dcf52469e821b3b2b69a0610c2c4f025a5aac68f.tar.xz |
Move time_bound_deferred into Clock
Diffstat (limited to '')
-rw-r--r-- | synapse/util/async.py | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/synapse/util/async.py b/synapse/util/async.py index d4d1d4b472..c4fe5d522f 100644 --- a/synapse/util/async.py +++ b/synapse/util/async.py @@ -32,23 +32,3 @@ def run_on_reactor(): iteration of the main loop """ return sleep(0) - - -def time_bound_deferred(given_deferred, clock, time_out): - ret_deferred = defer.Deferred() - - def timed_out(): - if not given_deferred.called: - given_deferred.cancel() - ret_deferred.errback(RuntimeError("Timed out")) - - timer = clock.call_later(time_out, timed_out) - - def succeed(result): - clock.cancel_call_later(timer) - ret_deferred.callback(result) - - given_deferred.addCallback(succeed) - given_deferred.addErrback(ret_deferred.errback) - - return ret_deferred |