mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-08 06:22:00 +00:00
Merge pull request #2480 from matrix-org/rav/federation_client_logging
Improve logging of failures in matrixfederationclient
This commit is contained in:
commit
d5325d7ef1
@ -204,18 +204,15 @@ class MatrixFederationHttpClient(object):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
logger.warn(
|
logger.warn(
|
||||||
"{%s} Sending request failed to %s: %s %s: %s - %s",
|
"{%s} Sending request failed to %s: %s %s: %s",
|
||||||
txn_id,
|
txn_id,
|
||||||
destination,
|
destination,
|
||||||
method,
|
method,
|
||||||
url_bytes,
|
url_bytes,
|
||||||
type(e).__name__,
|
|
||||||
_flatten_response_never_received(e),
|
_flatten_response_never_received(e),
|
||||||
)
|
)
|
||||||
|
|
||||||
log_result = "%s - %s" % (
|
log_result = _flatten_response_never_received(e)
|
||||||
type(e).__name__, _flatten_response_never_received(e),
|
|
||||||
)
|
|
||||||
|
|
||||||
if retries_left and not timeout:
|
if retries_left and not timeout:
|
||||||
if long_retries:
|
if long_retries:
|
||||||
@ -578,12 +575,14 @@ class _JsonProducer(object):
|
|||||||
|
|
||||||
def _flatten_response_never_received(e):
|
def _flatten_response_never_received(e):
|
||||||
if hasattr(e, "reasons"):
|
if hasattr(e, "reasons"):
|
||||||
return ", ".join(
|
reasons = ", ".join(
|
||||||
_flatten_response_never_received(f.value)
|
_flatten_response_never_received(f.value)
|
||||||
for f in e.reasons
|
for f in e.reasons
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return "%s:[%s]" % (type(e).__name__, reasons)
|
||||||
else:
|
else:
|
||||||
return "%s: %s" % (type(e).__name__, e.message,)
|
return repr(e)
|
||||||
|
|
||||||
|
|
||||||
def check_content_type_is_json(headers):
|
def check_content_type_is_json(headers):
|
||||||
|
Loading…
Reference in New Issue
Block a user