mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 13:04:21 -04:00
Fix exceptions in logs when failing to get remote room list (#10541)
This commit is contained in:
parent
1bebc0b78c
commit
60f0534b6e
5 changed files with 134 additions and 38 deletions
|
@ -356,6 +356,12 @@ class RoomListHandler(BaseHandler):
|
|||
include_all_networks: bool = False,
|
||||
third_party_instance_id: Optional[str] = None,
|
||||
) -> JsonDict:
|
||||
"""Get the public room list from remote server
|
||||
|
||||
Raises:
|
||||
SynapseError
|
||||
"""
|
||||
|
||||
if not self.enable_room_list_search:
|
||||
return {"chunk": [], "total_room_count_estimate": 0}
|
||||
|
||||
|
@ -395,13 +401,16 @@ class RoomListHandler(BaseHandler):
|
|||
limit = None
|
||||
since_token = None
|
||||
|
||||
res = await self._get_remote_list_cached(
|
||||
server_name,
|
||||
limit=limit,
|
||||
since_token=since_token,
|
||||
include_all_networks=include_all_networks,
|
||||
third_party_instance_id=third_party_instance_id,
|
||||
)
|
||||
try:
|
||||
res = await self._get_remote_list_cached(
|
||||
server_name,
|
||||
limit=limit,
|
||||
since_token=since_token,
|
||||
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")
|
||||
|
||||
if search_filter:
|
||||
res = {
|
||||
|
@ -423,20 +432,21 @@ class RoomListHandler(BaseHandler):
|
|||
include_all_networks: bool = False,
|
||||
third_party_instance_id: Optional[str] = None,
|
||||
) -> JsonDict:
|
||||
"""Wrapper around FederationClient.get_public_rooms that caches the
|
||||
result.
|
||||
"""
|
||||
|
||||
repl_layer = self.hs.get_federation_client()
|
||||
if search_filter:
|
||||
# We can't cache when asking for search
|
||||
try:
|
||||
return await repl_layer.get_public_rooms(
|
||||
server_name,
|
||||
limit=limit,
|
||||
since_token=since_token,
|
||||
search_filter=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")
|
||||
return await repl_layer.get_public_rooms(
|
||||
server_name,
|
||||
limit=limit,
|
||||
since_token=since_token,
|
||||
search_filter=search_filter,
|
||||
include_all_networks=include_all_networks,
|
||||
third_party_instance_id=third_party_instance_id,
|
||||
)
|
||||
|
||||
key = (
|
||||
server_name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue