From 47a3d7ca24d1eec3057fd4591bd10266ee793211 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 10 Sep 2018 17:18:11 +0100 Subject: split out 3792 back whence it came --- synapse/storage/state.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'synapse/storage/state.py') diff --git a/synapse/storage/state.py b/synapse/storage/state.py index 9886bd7f56..4b971efdba 100644 --- a/synapse/storage/state.py +++ b/synapse/storage/state.py @@ -175,7 +175,6 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore): # Turns out that postgres doesn't like doing a list of OR's and # is about 1000x slower, so we just issue a query for each specific # type seperately. - additional_args = () if types: clause_to_args = [ ( @@ -190,17 +189,19 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore): if include_other_types: unique_types = set(filtered_types) - sql += " AND type <> ? " * len(unique_types) - additional_args = list(unique_types) + clause_to_args.append( + ( + "AND type <> ? " * len(unique_types), + list(unique_types) + ) + ) else: # If types is None we fetch all the state, and so just use an # empty where clause with no extra args. clause_to_args = [("", [])] - for where_clause, where_args in clause_to_args: args = [room_id] args.extend(where_args) - args.extend(additional_args) txn.execute(sql % (where_clause,), args) for row in txn: typ, state_key, event_id = row -- cgit 1.5.1