Skip to content

Commit e7ca69d

Browse files
committed
Remove None handling
Since `_get_e2e_cross_signing_signatures_for_devices` always return a key for every entry in `device_query`, there will never be a case where the function can return `None`, even when decorated with `@cacheList`.
1 parent 90387cc commit e7ca69d

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

synapse/storage/databases/main/end_to_end_keys.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,6 @@ async def get_e2e_device_keys_and_signatures(
377377
user_id, {}
378378
)
379379

380-
if signature_list is None:
381-
# There are no signatures for this user_id/device_id combination.
382-
# We do this here to ensure that the "signatures" key gets created above,
383-
# even if it is empty.
384-
continue
385-
386380
for key_id, signature in signature_list:
387381
signing_user_signatures[key_id] = signature
388382

@@ -507,7 +501,7 @@ def _get_e2e_cross_signing_signatures_for_device(
507501
)
508502
async def _get_e2e_cross_signing_signatures_for_devices(
509503
self, device_query: Iterable[Tuple[str, str]]
510-
) -> Mapping[Tuple[str, str], Optional[Sequence[Tuple[str, str]]]]:
504+
) -> Mapping[Tuple[str, str], Sequence[Tuple[str, str]]]:
511505
"""Get cross-signing signatures for a given list of user IDs and devices.
512506
513507
Args:
@@ -516,9 +510,8 @@ async def _get_e2e_cross_signing_signatures_for_devices(
516510
Returns:
517511
A mapping of results. The keys are the original (user_id, device_id)
518512
tuple, while the value is the matching list of tuples of
519-
(key_id, signature). The value will be `None` instead if no
520-
signatures exist for the device (this is a behaviour of
521-
`@cachedList`).
513+
(key_id, signature). The value will be an empty list if no
514+
signatures exist for the device.
522515
523516
Given this method is annotated with `@cachedList`, the return dict's
524517
keys match the tuples within `device_query`, so that cache entries can

0 commit comments

Comments
 (0)