0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-16 15:01:23 +01:00

Merge pull request #5713 from matrix-org/erikj/use_cache_for_filtered_state

Delegate to cached version when using get_filtered_current_state_ids
This commit is contained in:
Erik Johnston 2019-07-19 16:30:49 +01:00 committed by GitHub
commit d7bd9651bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

1
changelog.d/5713.misc Normal file
View file

@ -0,0 +1 @@
Improve caching when fetching `get_filtered_current_state_ids`.

View file

@ -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,)