summary refs log tree commit diff
path: root/synapse/storage/devices.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-01-31 11:20:03 +0000
committerErik Johnston <erik@matrix.org>2017-01-31 11:20:03 +0000
commitd3169e8d28a4b7238256ff4d3151e3cc8feef0e1 (patch)
treef00f0bfc914a28c97f805bef702a558535b2d822 /synapse/storage/devices.py
parentFix clearing out old device list outbound pokes (diff)
downloadsynapse-d3169e8d28a4b7238256ff4d3151e3cc8feef0e1.tar.xz
Only fetch with row ts and count > 1
Diffstat (limited to '')
-rw-r--r--synapse/storage/devices.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/storage/devices.py b/synapse/storage/devices.py
index e6fe67ee25..cccefdd3d2 100644
--- a/synapse/storage/devices.py
+++ b/synapse/storage/devices.py
@@ -552,9 +552,10 @@ class DeviceStore(SQLBaseStore):
                 SELECT destination, user_id, max(stream_id) as stream_id
                 FROM device_lists_outbound_pokes
                 GROUP BY destination, user_id
+                HAVING min(ts) < ? AND count(*) > 1
             """
 
-            txn.execute(select_sql)
+            txn.execute(select_sql, (yesterday,))
             rows = txn.fetchall()
 
             if not rows: