mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Clean up backoff_on_404 and metehod calls
This commit is contained in:
parent
2150151abe
commit
b41c2eaadc
@ -193,7 +193,6 @@ class MatrixFederationHttpClient(object):
|
|||||||
self,
|
self,
|
||||||
request,
|
request,
|
||||||
try_trailing_slash_on_400=False,
|
try_trailing_slash_on_400=False,
|
||||||
backoff_on_404=False,
|
|
||||||
**send_request_args
|
**send_request_args
|
||||||
):
|
):
|
||||||
"""Wrapper for _send_request which can optionally retry the request
|
"""Wrapper for _send_request which can optionally retry the request
|
||||||
@ -206,8 +205,6 @@ class MatrixFederationHttpClient(object):
|
|||||||
try_trailing_slash_on_400 (bool): Whether on receiving a 400
|
try_trailing_slash_on_400 (bool): Whether on receiving a 400
|
||||||
'M_UNRECOGNIZED' from the server to retry the request with a
|
'M_UNRECOGNIZED' from the server to retry the request with a
|
||||||
trailing slash appended to the request path.
|
trailing slash appended to the request path.
|
||||||
backoff_on_404 (bool): Whether to backoff on 404 when making a
|
|
||||||
request with a trailing slash.
|
|
||||||
send_request_args (Dict): A dictionary of arguments to pass to
|
send_request_args (Dict): A dictionary of arguments to pass to
|
||||||
`_send_request()`.
|
`_send_request()`.
|
||||||
|
|
||||||
@ -220,7 +217,7 @@ class MatrixFederationHttpClient(object):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
response = yield self._send_request(
|
response = yield self._send_request(
|
||||||
request, backoff_on_404=backoff_on_404, **send_request_args
|
request, **send_request_args
|
||||||
)
|
)
|
||||||
except HttpResponseException as e:
|
except HttpResponseException as e:
|
||||||
# Received an HTTP error > 300. Check if it meets the requirements
|
# Received an HTTP error > 300. Check if it meets the requirements
|
||||||
@ -237,7 +234,7 @@ class MatrixFederationHttpClient(object):
|
|||||||
request.path += "/"
|
request.path += "/"
|
||||||
|
|
||||||
response = yield self._send_request(
|
response = yield self._send_request(
|
||||||
request, backoff_on_404=backoff_on_404, **send_request_args
|
request, **send_request_args
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
@ -579,8 +576,12 @@ class MatrixFederationHttpClient(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = yield self._send_request_with_optional_trailing_slash(
|
response = yield self._send_request_with_optional_trailing_slash(
|
||||||
request, try_trailing_slash_on_400, backoff_on_404,
|
request,
|
||||||
long_retries=long_retries, timeout=timeout, ignore_backoff=ignore_backoff,
|
try_trailing_slash_on_400,
|
||||||
|
backoff_on_404=backoff_on_404,
|
||||||
|
ignore_backoff=ignore_backoff,
|
||||||
|
long_retries=long_retries,
|
||||||
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
|
|
||||||
body = yield _handle_json_response(
|
body = yield _handle_json_response(
|
||||||
@ -693,9 +694,12 @@ class MatrixFederationHttpClient(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = yield self._send_request_with_optional_trailing_slash(
|
response = yield self._send_request_with_optional_trailing_slash(
|
||||||
request, try_trailing_slash_on_400, False,
|
request,
|
||||||
retry_on_dns_fail=retry_on_dns_fail, timeout=timeout,
|
try_trailing_slash_on_400,
|
||||||
|
backoff_on_404=False,
|
||||||
ignore_backoff=ignore_backoff,
|
ignore_backoff=ignore_backoff,
|
||||||
|
retry_on_dns_fail=retry_on_dns_fail,
|
||||||
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
|
|
||||||
body = yield _handle_json_response(
|
body = yield _handle_json_response(
|
||||||
|
Loading…
Reference in New Issue
Block a user