summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-10-22 13:25:22 +0100
committerErik Johnston <erik@matrix.org>2015-10-22 13:25:27 +0100
commitba02bba88c6895bc9196d226a2bbc8047b93e28b (patch)
tree68a4b9c0d735c0a885995b0224bfea61955747e7 /synapse
parentMerge branch 'develop' of github.com:matrix-org/synapse into erikj/search (diff)
downloadsynapse-ba02bba88c6895bc9196d226a2bbc8047b93e28b.tar.xz
Limit max number of SQL vars
Diffstat (limited to 'synapse')
-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: