diff options
author | Erik Johnston <erik@matrix.org> | 2015-10-22 13:25:22 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-10-22 13:25:27 +0100 |
commit | ba02bba88c6895bc9196d226a2bbc8047b93e28b (patch) | |
tree | 68a4b9c0d735c0a885995b0224bfea61955747e7 | |
parent | Merge branch 'develop' of github.com:matrix-org/synapse into erikj/search (diff) | |
download | synapse-ba02bba88c6895bc9196d226a2bbc8047b93e28b.tar.xz |
Limit max number of SQL vars
Diffstat (limited to '')
-rw-r--r-- | synapse/storage/search.py | 10 |
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: |