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

Commit 10c72a3

Browse files
committed
Fix when to use unstable endpoint.
1 parent ac3a70a commit 10c72a3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

synapse/federation/federation_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ async def claim_client_keys(
260260
use_unstable = False
261261
for user_id, one_time_keys in query.items():
262262
for device_id, algorithms in one_time_keys.items():
263-
if any(count > 1 for count in algorithms.values()):
263+
# If more than one algorithm is requested, attempt to use the unstable
264+
# endpoint.
265+
if sum(algorithms.values()) > 1:
264266
use_unstable = True
265267
if algorithms:
266268
# For the stable query, choose only the first algorithm.
@@ -296,6 +298,7 @@ async def claim_client_keys(
296298
else:
297299
logger.debug("Skipping unstable claim client keys API")
298300

301+
# TODO Potentially attempt multiple queries and combine the results?
299302
return await self.transport_layer.claim_client_keys(
300303
user, destination, content, timeout
301304
)

0 commit comments

Comments
 (0)