summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-09-02 15:53:26 +0100
committerGitHub <noreply@github.com>2020-09-02 15:53:26 +0100
commit0d4f614fdae1221bd1833d9cdeb5adc3850d3af9 (patch)
tree5e1f2cd2e2a5e20eb6608f297d9a8437c3619f10 /synapse/storage
parentAdd experimental support for sharding event persister. (#8170) (diff)
downloadsynapse-0d4f614fdae1221bd1833d9cdeb5adc3850d3af9.tar.xz
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
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/databases/main/end_to_end_keys.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/synapse/storage/databases/main/end_to_end_keys.py b/synapse/storage/databases/main/end_to_end_keys.py
index 449d95f31e..4059701cfd 100644
--- a/synapse/storage/databases/main/end_to_end_keys.py
+++ b/synapse/storage/databases/main/end_to_end_keys.py
@@ -24,7 +24,7 @@ from twisted.enterprise.adbapi import Connection
 
 from synapse.logging.opentracing import log_kv, set_tag, trace
 from synapse.storage._base import SQLBaseStore, db_to_json
-from synapse.storage.database import LoggingTransaction, make_in_list_sql_clause
+from synapse.storage.database import make_in_list_sql_clause
 from synapse.types import JsonDict
 from synapse.util import json_encoder
 from synapse.util.caches.descriptors import cached, cachedList
@@ -58,18 +58,13 @@ class EndToEndKeyWorkerStore(SQLBaseStore):
         Returns:
             (stream_id, devices)
         """
-        return await self.db_pool.runInteraction(
-            "get_e2e_device_keys_for_federation_query",
-            self._get_e2e_device_keys_for_federation_query_txn,
-            user_id,
-        )
-
-    def _get_e2e_device_keys_for_federation_query_txn(
-        self, txn: LoggingTransaction, user_id: str
-    ) -> Tuple[int, List[JsonDict]]:
         now_stream_id = self.get_device_stream_token()
 
-        devices = self._get_e2e_device_keys_and_signatures_txn(txn, [(user_id, None)])
+        devices = await self.db_pool.runInteraction(
+            "get_e2e_device_keys_and_signatures_txn",
+            self._get_e2e_device_keys_and_signatures_txn,
+            [(user_id, None)],
+        )
 
         if devices:
             user_devices = devices[user_id]