summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/search.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/storage/search.py b/synapse/storage/search.py
index a3c69c5ab3..810b5406ad 100644
--- a/synapse/storage/search.py
+++ b/synapse/storage/search.py
@@ -36,10 +36,12 @@ class SearchStore(SQLBaseStore):
         clauses = []
         args = []
 
-        clauses.append(
-            "room_id IN (%s)" % (",".join(["?"] * len(room_ids)),)
-        )
-        args.extend(room_ids)
+        # Make sure we don't explode because the person is in too many rooms.
+        if len(room_ids) > 500:
+            clauses.append(
+                "room_id IN (%s)" % (",".join(["?"] * len(room_ids)),)
+            )
+            args.extend(room_ids)
 
         local_clauses = []
         for key in keys: