From ac5491f56308405890530ae09ac6ffcf93ad48b7 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 6 Mar 2017 11:10:10 +0000 Subject: [PATCH] Select distinct devices from DB Otherwise we might pull out tonnes of duplicate user_ids and this can make synapse sad. --- synapse/storage/devices.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/storage/devices.py b/synapse/storage/devices.py index 81c43d31f..bd56ba251 100644 --- a/synapse/storage/devices.py +++ b/synapse/storage/devices.py @@ -508,7 +508,7 @@ class DeviceStore(SQLBaseStore): defer.returnValue(set(changed)) sql = """ - SELECT user_id FROM device_lists_stream WHERE stream_id > ? + SELECT DISTINCT user_id FROM device_lists_stream WHERE stream_id > ? """ rows = yield self._execute("get_user_whose_devices_changed", None, sql, from_key) defer.returnValue(set(row[0] for row in rows))