Limit max number of SQL vars

This commit is contained in:
Erik Johnston 2015-10-22 13:25:22 +01:00
parent 1fc2d11a14
commit ba02bba88c

View File

@ -36,10 +36,12 @@ class SearchStore(SQLBaseStore):
clauses = [] clauses = []
args = [] args = []
clauses.append( # Make sure we don't explode because the person is in too many rooms.
"room_id IN (%s)" % (",".join(["?"] * len(room_ids)),) if len(room_ids) > 500:
) clauses.append(
args.extend(room_ids) "room_id IN (%s)" % (",".join(["?"] * len(room_ids)),)
)
args.extend(room_ids)
local_clauses = [] local_clauses = []
for key in keys: for key in keys: