mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Reduce memory usage of state group cache (#13323)
This commit is contained in:
parent
1efe6b8c41
commit
de70b25e84
1
changelog.d/13323.misc
Normal file
1
changelog.d/13323.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Reduce memory usage of state caches.
|
@ -24,6 +24,7 @@ from synapse.storage.database import (
|
|||||||
from synapse.storage.engines import PostgresEngine
|
from synapse.storage.engines import PostgresEngine
|
||||||
from synapse.storage.state import StateFilter
|
from synapse.storage.state import StateFilter
|
||||||
from synapse.types import MutableStateMap, StateMap
|
from synapse.types import MutableStateMap, StateMap
|
||||||
|
from synapse.util.caches import intern_string
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from synapse.server import HomeServer
|
from synapse.server import HomeServer
|
||||||
@ -136,7 +137,7 @@ class StateGroupBackgroundUpdateStore(SQLBaseStore):
|
|||||||
txn.execute(sql % (where_clause,), args)
|
txn.execute(sql % (where_clause,), args)
|
||||||
for row in txn:
|
for row in txn:
|
||||||
typ, state_key, event_id = row
|
typ, state_key, event_id = row
|
||||||
key = (typ, state_key)
|
key = (intern_string(typ), intern_string(state_key))
|
||||||
results[group][key] = event_id
|
results[group][key] = event_id
|
||||||
else:
|
else:
|
||||||
max_entries_returned = state_filter.max_entries_returned()
|
max_entries_returned = state_filter.max_entries_returned()
|
||||||
|
Loading…
Reference in New Issue
Block a user