mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-18 10:14:20 -05:00
Merge pull request #5790 from matrix-org/erikj/groups_request_errors
Handle RequestSendFailed exception correctly in more places.
This commit is contained in:
commit
0f632f3a57
1
changelog.d/5790.misc
Normal file
1
changelog.d/5790.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Remove some spurious exceptions from the logs where we failed to talk to a remote server.
|
@ -978,6 +978,9 @@ class FederationHandler(BaseHandler):
|
|||||||
except NotRetryingDestination as e:
|
except NotRetryingDestination as e:
|
||||||
logger.info(str(e))
|
logger.info(str(e))
|
||||||
continue
|
continue
|
||||||
|
except RequestSendFailed as e:
|
||||||
|
logger.info("Falied to get backfill from %s because %s", dom, e)
|
||||||
|
continue
|
||||||
except FederationDeniedError as e:
|
except FederationDeniedError as e:
|
||||||
logger.info(e)
|
logger.info(e)
|
||||||
continue
|
continue
|
||||||
|
@ -126,9 +126,12 @@ class GroupsLocalHandler(object):
|
|||||||
group_id, requester_user_id
|
group_id, requester_user_id
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
res = yield self.transport_client.get_group_summary(
|
res = yield self.transport_client.get_group_summary(
|
||||||
get_domain_from_id(group_id), group_id, requester_user_id
|
get_domain_from_id(group_id), group_id, requester_user_id
|
||||||
)
|
)
|
||||||
|
except RequestSendFailed:
|
||||||
|
raise SynapseError(502, "Failed to contact group server")
|
||||||
|
|
||||||
group_server_name = get_domain_from_id(group_id)
|
group_server_name = get_domain_from_id(group_id)
|
||||||
|
|
||||||
@ -183,9 +186,12 @@ class GroupsLocalHandler(object):
|
|||||||
|
|
||||||
content["user_profile"] = yield self.profile_handler.get_profile(user_id)
|
content["user_profile"] = yield self.profile_handler.get_profile(user_id)
|
||||||
|
|
||||||
|
try:
|
||||||
res = yield self.transport_client.create_group(
|
res = yield self.transport_client.create_group(
|
||||||
get_domain_from_id(group_id), group_id, user_id, content
|
get_domain_from_id(group_id), group_id, user_id, content
|
||||||
)
|
)
|
||||||
|
except RequestSendFailed:
|
||||||
|
raise SynapseError(502, "Failed to contact group server")
|
||||||
|
|
||||||
remote_attestation = res["attestation"]
|
remote_attestation = res["attestation"]
|
||||||
yield self.attestations.verify_attestation(
|
yield self.attestations.verify_attestation(
|
||||||
@ -221,9 +227,12 @@ class GroupsLocalHandler(object):
|
|||||||
|
|
||||||
group_server_name = get_domain_from_id(group_id)
|
group_server_name = get_domain_from_id(group_id)
|
||||||
|
|
||||||
|
try:
|
||||||
res = yield self.transport_client.get_users_in_group(
|
res = yield self.transport_client.get_users_in_group(
|
||||||
get_domain_from_id(group_id), group_id, requester_user_id
|
get_domain_from_id(group_id), group_id, requester_user_id
|
||||||
)
|
)
|
||||||
|
except RequestSendFailed:
|
||||||
|
raise SynapseError(502, "Failed to contact group server")
|
||||||
|
|
||||||
chunk = res["chunk"]
|
chunk = res["chunk"]
|
||||||
valid_entries = []
|
valid_entries = []
|
||||||
@ -258,9 +267,12 @@ class GroupsLocalHandler(object):
|
|||||||
local_attestation = self.attestations.create_attestation(group_id, user_id)
|
local_attestation = self.attestations.create_attestation(group_id, user_id)
|
||||||
content["attestation"] = local_attestation
|
content["attestation"] = local_attestation
|
||||||
|
|
||||||
|
try:
|
||||||
res = yield self.transport_client.join_group(
|
res = yield self.transport_client.join_group(
|
||||||
get_domain_from_id(group_id), group_id, user_id, content
|
get_domain_from_id(group_id), group_id, user_id, content
|
||||||
)
|
)
|
||||||
|
except RequestSendFailed:
|
||||||
|
raise SynapseError(502, "Failed to contact group server")
|
||||||
|
|
||||||
remote_attestation = res["attestation"]
|
remote_attestation = res["attestation"]
|
||||||
|
|
||||||
@ -299,9 +311,12 @@ class GroupsLocalHandler(object):
|
|||||||
local_attestation = self.attestations.create_attestation(group_id, user_id)
|
local_attestation = self.attestations.create_attestation(group_id, user_id)
|
||||||
content["attestation"] = local_attestation
|
content["attestation"] = local_attestation
|
||||||
|
|
||||||
|
try:
|
||||||
res = yield self.transport_client.accept_group_invite(
|
res = yield self.transport_client.accept_group_invite(
|
||||||
get_domain_from_id(group_id), group_id, user_id, content
|
get_domain_from_id(group_id), group_id, user_id, content
|
||||||
)
|
)
|
||||||
|
except RequestSendFailed:
|
||||||
|
raise SynapseError(502, "Failed to contact group server")
|
||||||
|
|
||||||
remote_attestation = res["attestation"]
|
remote_attestation = res["attestation"]
|
||||||
|
|
||||||
@ -338,6 +353,7 @@ class GroupsLocalHandler(object):
|
|||||||
group_id, user_id, requester_user_id, content
|
group_id, user_id, requester_user_id, content
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
res = yield self.transport_client.invite_to_group(
|
res = yield self.transport_client.invite_to_group(
|
||||||
get_domain_from_id(group_id),
|
get_domain_from_id(group_id),
|
||||||
group_id,
|
group_id,
|
||||||
@ -345,6 +361,8 @@ class GroupsLocalHandler(object):
|
|||||||
requester_user_id,
|
requester_user_id,
|
||||||
content,
|
content,
|
||||||
)
|
)
|
||||||
|
except RequestSendFailed:
|
||||||
|
raise SynapseError(502, "Failed to contact group server")
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@ -398,6 +416,7 @@ class GroupsLocalHandler(object):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
content["requester_user_id"] = requester_user_id
|
content["requester_user_id"] = requester_user_id
|
||||||
|
try:
|
||||||
res = yield self.transport_client.remove_user_from_group(
|
res = yield self.transport_client.remove_user_from_group(
|
||||||
get_domain_from_id(group_id),
|
get_domain_from_id(group_id),
|
||||||
group_id,
|
group_id,
|
||||||
@ -405,6 +424,8 @@ class GroupsLocalHandler(object):
|
|||||||
user_id,
|
user_id,
|
||||||
content,
|
content,
|
||||||
)
|
)
|
||||||
|
except RequestSendFailed:
|
||||||
|
raise SynapseError(502, "Failed to contact group server")
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@ -435,9 +456,13 @@ class GroupsLocalHandler(object):
|
|||||||
|
|
||||||
return {"groups": result}
|
return {"groups": result}
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
bulk_result = yield self.transport_client.bulk_get_publicised_groups(
|
bulk_result = yield self.transport_client.bulk_get_publicised_groups(
|
||||||
get_domain_from_id(user_id), [user_id]
|
get_domain_from_id(user_id), [user_id]
|
||||||
)
|
)
|
||||||
|
except RequestSendFailed:
|
||||||
|
raise SynapseError(502, "Failed to contact group server")
|
||||||
|
|
||||||
result = bulk_result.get("users", {}).get(user_id)
|
result = bulk_result.get("users", {}).get(user_id)
|
||||||
# TODO: Verify attestations
|
# TODO: Verify attestations
|
||||||
return {"groups": result}
|
return {"groups": result}
|
||||||
|
Loading…
Reference in New Issue
Block a user