mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-02 21:54:50 -04:00
Merge pull request #61 from matrix-org/timeout-federation-requests
Timeout federation requests
This commit is contained in:
commit
c52e8d395b
3 changed files with 63 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue