Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix when to use unstable endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Jun 9, 2023
1 parent ac3a70a commit 10c72a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion synapse/federation/federation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ async def claim_client_keys(
use_unstable = False
for user_id, one_time_keys in query.items():
for device_id, algorithms in one_time_keys.items():
if any(count > 1 for count in algorithms.values()):
# If more than one algorithm is requested, attempt to use the unstable
# endpoint.
if sum(algorithms.values()) > 1:
use_unstable = True
if algorithms:
# For the stable query, choose only the first algorithm.
Expand Down Expand Up @@ -296,6 +298,7 @@ async def claim_client_keys(
else:
logger.debug("Skipping unstable claim client keys API")

# TODO Potentially attempt multiple queries and combine the results?
return await self.transport_layer.claim_client_keys(
user, destination, content, timeout
)
Expand Down

0 comments on commit 10c72a3

Please sign in to comment.