From 22b926c284f98b5507583a3a7866da12a9f4bb47 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 28 Aug 2020 15:59:28 +0100 Subject: [PATCH] Only return devices with keys from `/federation/v1/user/devices/` (#8198) There's not much point in returning all the others, and some people have a silly number of devices. --- changelog.d/8198.feature | 1 + synapse/storage/databases/main/devices.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 changelog.d/8198.feature diff --git a/changelog.d/8198.feature b/changelog.d/8198.feature new file mode 100644 index 000000000..c4401288b --- /dev/null +++ b/changelog.d/8198.feature @@ -0,0 +1 @@ +Optimise `/federation/v1/user/devices/` API by only returning devices with encryption keys. diff --git a/synapse/storage/databases/main/devices.py b/synapse/storage/databases/main/devices.py index ecd3f3b31..def96637a 100644 --- a/synapse/storage/databases/main/devices.py +++ b/synapse/storage/databases/main/devices.py @@ -498,9 +498,7 @@ class DeviceWorkerStore(SQLBaseStore): ) -> Tuple[int, List[JsonDict]]: now_stream_id = self._device_list_id_gen.get_current_token() - devices = self._get_e2e_device_keys_txn( - txn, [(user_id, None)], include_all_devices=True - ) + devices = self._get_e2e_device_keys_txn(txn, [(user_id, None)]) if devices: user_devices = devices[user_id]