mirror of
https://github.com/element-hq/synapse
synced 2024-08-30 14:40:21 +00:00
Reduce timeout for outbound /key/v2/server requests.
This commit is contained in:
parent
fec2dcb1a5
commit
06a1f3e207
1 changed files with 13 additions and 0 deletions
|
@ -786,6 +786,19 @@ class ServerKeyFetcher(BaseV2KeyFetcher):
|
||||||
path="/_matrix/key/v2/server/"
|
path="/_matrix/key/v2/server/"
|
||||||
+ urllib.parse.quote(requested_key_id),
|
+ urllib.parse.quote(requested_key_id),
|
||||||
ignore_backoff=True,
|
ignore_backoff=True,
|
||||||
|
|
||||||
|
# we only give the remote server 10s to respond. It should be an
|
||||||
|
# easy request to handle, so if it doesn't reply within 10s, it's
|
||||||
|
# probably not going to.
|
||||||
|
#
|
||||||
|
# Furthermore, when we are acting as a notary server, we cannot
|
||||||
|
# wait all day for all of the origin servers, as the requesting
|
||||||
|
# server will otherwise time out before we can respond.
|
||||||
|
#
|
||||||
|
# (Note that get_json may make 4 attempts, so this can still take
|
||||||
|
# almost 45 seconds to fetch the headers, plus up to another 60s to
|
||||||
|
# read the response).
|
||||||
|
timeout=10000,
|
||||||
)
|
)
|
||||||
except (NotRetryingDestination, RequestSendFailed) as e:
|
except (NotRetryingDestination, RequestSendFailed) as e:
|
||||||
raise_from(KeyLookupError("Failed to connect to remote server"), e)
|
raise_from(KeyLookupError("Failed to connect to remote server"), e)
|
||||||
|
|
Loading…
Reference in a new issue