diff options
author | Erik Johnston <erik@matrix.org> | 2015-02-11 17:10:33 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-02-11 17:10:33 +0000 |
commit | c52e8d395be2e6bc7bd2e768cd3fdc18df448603 (patch) | |
tree | 76a07d178fcbe350bc6f2046b05a045e00bdaaf2 /synapse/http | |
parent | Merge pull request #62 from matrix-org/state-chache (diff) | |
parent | Fix so timing out connections to actually work. (diff) | |
download | synapse-c52e8d395be2e6bc7bd2e768cd3fdc18df448603.tar.xz |
Merge pull request #61 from matrix-org/timeout-federation-requests
Timeout federation requests
Diffstat (limited to 'synapse/http')
-rw-r--r-- | synapse/http/matrixfederationclient.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py index 406203acf2..1927948001 100644 --- a/synapse/http/matrixfederationclient.py +++ b/synapse/http/matrixfederationclient.py @@ -79,6 +79,7 @@ class MatrixFederationHttpClient(object): self.signing_key = hs.config.signing_key[0] self.server_name = hs.hostname self.agent = MatrixFederationHttpAgent(reactor) + self.clock = hs.get_clock() @defer.inlineCallbacks def _create_request(self, destination, method, path_bytes, @@ -118,7 +119,7 @@ class MatrixFederationHttpClient(object): try: with PreserveLoggingContext(): - response = yield self.agent.request( + request_deferred = self.agent.request( destination, endpoint, method, @@ -129,6 +130,11 @@ class MatrixFederationHttpClient(object): producer ) + response = yield self.clock.time_bound_deferred( + request_deferred, + time_out=60, + ) + logger.debug("Got response to %s", method) break except Exception as e: |