Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Reduce memory usage of state group cache (#13323)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston authored Jul 19, 2022
1 parent 1efe6b8 commit de70b25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/13323.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reduce memory usage of state caches.
3 changes: 2 additions & 1 deletion synapse/storage/databases/state/bg_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from synapse.storage.engines import PostgresEngine
from synapse.storage.state import StateFilter
from synapse.types import MutableStateMap, StateMap
from synapse.util.caches import intern_string

if TYPE_CHECKING:
from synapse.server import HomeServer
Expand Down Expand Up @@ -136,7 +137,7 @@ def _get_state_groups_from_groups_txn(
txn.execute(sql % (where_clause,), args)
for row in txn:
typ, state_key, event_id = row
key = (typ, state_key)
key = (intern_string(typ), intern_string(state_key))
results[group][key] = event_id
else:
max_entries_returned = state_filter.max_entries_returned()
Expand Down

0 comments on commit de70b25

Please sign in to comment.