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

Commit 0d4f614

Browse files
authored
Refactor _get_e2e_device_keys_for_federation_query_txn (#8225)
We can use the existing `_get_e2e_device_keys_and_signatures_txn` instead of creating our own txn function
1 parent 82c1ee1 commit 0d4f614

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

changelog.d/8225.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Refactor queries for device keys and cross-signatures.

synapse/storage/databases/main/end_to_end_keys.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from synapse.logging.opentracing import log_kv, set_tag, trace
2626
from synapse.storage._base import SQLBaseStore, db_to_json
27-
from synapse.storage.database import LoggingTransaction, make_in_list_sql_clause
27+
from synapse.storage.database import make_in_list_sql_clause
2828
from synapse.types import JsonDict
2929
from synapse.util import json_encoder
3030
from synapse.util.caches.descriptors import cached, cachedList
@@ -58,18 +58,13 @@ async def get_e2e_device_keys_for_federation_query(
5858
Returns:
5959
(stream_id, devices)
6060
"""
61-
return await self.db_pool.runInteraction(
62-
"get_e2e_device_keys_for_federation_query",
63-
self._get_e2e_device_keys_for_federation_query_txn,
64-
user_id,
65-
)
66-
67-
def _get_e2e_device_keys_for_federation_query_txn(
68-
self, txn: LoggingTransaction, user_id: str
69-
) -> Tuple[int, List[JsonDict]]:
7061
now_stream_id = self.get_device_stream_token()
7162

72-
devices = self._get_e2e_device_keys_and_signatures_txn(txn, [(user_id, None)])
63+
devices = await self.db_pool.runInteraction(
64+
"get_e2e_device_keys_and_signatures_txn",
65+
self._get_e2e_device_keys_and_signatures_txn,
66+
[(user_id, None)],
67+
)
7368

7469
if devices:
7570
user_devices = devices[user_id]

0 commit comments

Comments
 (0)