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.
This commit is contained in:
Richard van der Hoff 2020-08-28 15:59:28 +01:00 committed by GitHub
parent aec7085179
commit 22b926c284
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

1
changelog.d/8198.feature Normal file
View file

@ -0,0 +1 @@
Optimise `/federation/v1/user/devices/` API by only returning devices with encryption keys.

View file

@ -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]