-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix exceptions in logs when failing to get remote room list #10541
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix exceptions in logs when failing to get remote room list. |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -43,6 +43,7 @@ | |||||||||||||||||||||||||||
Codes, | ||||||||||||||||||||||||||||
FederationDeniedError, | ||||||||||||||||||||||||||||
HttpResponseException, | ||||||||||||||||||||||||||||
RequestSendFailed, | ||||||||||||||||||||||||||||
SynapseError, | ||||||||||||||||||||||||||||
UnsupportedRoomVersionError, | ||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
|
@@ -1113,14 +1114,17 @@ async def get_public_rooms( | |||||||||||||||||||||||||||
requests over federation | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||
return await self.transport_layer.get_public_rooms( | ||||||||||||||||||||||||||||
remote_server, | ||||||||||||||||||||||||||||
limit, | ||||||||||||||||||||||||||||
since_token, | ||||||||||||||||||||||||||||
search_filter, | ||||||||||||||||||||||||||||
include_all_networks=include_all_networks, | ||||||||||||||||||||||||||||
third_party_instance_id=third_party_instance_id, | ||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
try: | ||||||||||||||||||||||||||||
return await self.transport_layer.get_public_rooms( | ||||||||||||||||||||||||||||
remote_server, | ||||||||||||||||||||||||||||
limit, | ||||||||||||||||||||||||||||
since_token, | ||||||||||||||||||||||||||||
search_filter, | ||||||||||||||||||||||||||||
include_all_networks=include_all_networks, | ||||||||||||||||||||||||||||
third_party_instance_id=third_party_instance_id, | ||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
except (RequestSendFailed, HttpResponseException): | ||||||||||||||||||||||||||||
raise SynapseError(502, "Failed to fetch room list") | ||||||||||||||||||||||||||||
|
except HttpResponseException as hre: | |
syn_err = hre.to_synapse_error() | |
if hre.code in (404, 405) or syn_err.errcode in ( | |
Codes.UNRECOGNIZED, | |
Codes.NOT_FOUND, | |
): | |
logger.debug("Falling back to locally-filtered /publicRooms") | |
else: | |
# Not an error that should trigger a fallback. | |
raise SynapseError(502, "Failed to fetch room list") | |
except RequestSendFailed: | |
# Not an error that should trigger a fallback. | |
raise SynapseError(502, "Failed to fetch room list") |
And, if that weren't enough of a mess, PublicRoomListRestServlet
has another round of catching HttpResponseException
, which I think is meant to be unreachable, but who the hell knows.
I think you should allow the RequestSendFailed
/ HttpResponseException
s to propagate into RoomListHandler
and raise an appropriate SynapseError there; and remove the handling from PublicRoomListRestServlet
. And, for the love of $deity, document the behaviour of these things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wheeeeeee untested features
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want to log the error as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll have already logged that the federation request has failed, so I don't think there's much point