summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-07-18 15:17:37 +0100
committerErik Johnston <erik@matrix.org>2019-07-18 15:17:39 +0100
commit10523241d86eeaa1fa43607a03352f9e7b04efda (patch)
treee954f13b39c1fa481b151c94826bc58d8263202d /synapse/storage/state.py
parentClean up opentracing configuration options (#5712) (diff)
downloadsynapse-10523241d86eeaa1fa43607a03352f9e7b04efda.tar.xz
Delegate to cached version when using get_filtered_current_state_ids
In the case where it gets called with `StateFilter.all()`
Diffstat (limited to 'synapse/storage/state.py')
-rw-r--r--synapse/storage/state.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index 0bfe1b4550..a35289876d 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -510,6 +510,12 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore):
             event ID.
         """
 
+        where_clause, where_args = state_filter.make_sql_filter_clause()
+
+        if not where_clause:
+            # We delegate to the cached version
+            return self.get_current_state_ids(room_id)
+
         def _get_filtered_current_state_ids_txn(txn):
             results = {}
             sql = """
@@ -517,8 +523,6 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore):
                 WHERE room_id = ?
             """
 
-            where_clause, where_args = state_filter.make_sql_filter_clause()
-
             if where_clause:
                 sql += " AND (%s)" % (where_clause,)