mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
_CURRENT_STATE_CACHE_NAME is public
This commit is contained in:
parent
00f0d67566
commit
a7f20500ff
@ -19,7 +19,7 @@ from typing import Dict
|
|||||||
import six
|
import six
|
||||||
|
|
||||||
from synapse.storage._base import SQLBaseStore
|
from synapse.storage._base import SQLBaseStore
|
||||||
from synapse.storage.data_stores.main.cache import _CURRENT_STATE_CACHE_NAME
|
from synapse.storage.data_stores.main.cache import CURRENT_STATE_CACHE_NAME
|
||||||
from synapse.storage.engines import PostgresEngine
|
from synapse.storage.engines import PostgresEngine
|
||||||
|
|
||||||
from ._slaved_id_tracker import SlavedIdTracker
|
from ._slaved_id_tracker import SlavedIdTracker
|
||||||
@ -63,7 +63,7 @@ class BaseSlavedStore(SQLBaseStore):
|
|||||||
if stream_name == "caches":
|
if stream_name == "caches":
|
||||||
self._cache_id_gen.advance(token)
|
self._cache_id_gen.advance(token)
|
||||||
for row in rows:
|
for row in rows:
|
||||||
if row.cache_func == _CURRENT_STATE_CACHE_NAME:
|
if row.cache_func == CURRENT_STATE_CACHE_NAME:
|
||||||
room_id = row.keys[0]
|
room_id = row.keys[0]
|
||||||
members_changed = set(row.keys[1:])
|
members_changed = set(row.keys[1:])
|
||||||
self._invalidate_state_caches(room_id, members_changed)
|
self._invalidate_state_caches(room_id, members_changed)
|
||||||
|
@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
# This is a special cache name we use to batch multiple invalidations of caches
|
# This is a special cache name we use to batch multiple invalidations of caches
|
||||||
# based on the current state when notifying workers over replication.
|
# based on the current state when notifying workers over replication.
|
||||||
_CURRENT_STATE_CACHE_NAME = "cs_cache_fake"
|
CURRENT_STATE_CACHE_NAME = "cs_cache_fake"
|
||||||
|
|
||||||
|
|
||||||
class CacheInvalidationStore(SQLBaseStore):
|
class CacheInvalidationStore(SQLBaseStore):
|
||||||
@ -65,12 +65,12 @@ class CacheInvalidationStore(SQLBaseStore):
|
|||||||
for chunk in batch_iter(members_changed, 50):
|
for chunk in batch_iter(members_changed, 50):
|
||||||
keys = itertools.chain([room_id], chunk)
|
keys = itertools.chain([room_id], chunk)
|
||||||
self._send_invalidation_to_replication(
|
self._send_invalidation_to_replication(
|
||||||
txn, _CURRENT_STATE_CACHE_NAME, keys
|
txn, CURRENT_STATE_CACHE_NAME, keys
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# if no members changed, we still need to invalidate the other caches.
|
# if no members changed, we still need to invalidate the other caches.
|
||||||
self._send_invalidation_to_replication(
|
self._send_invalidation_to_replication(
|
||||||
txn, _CURRENT_STATE_CACHE_NAME, [room_id]
|
txn, CURRENT_STATE_CACHE_NAME, [room_id]
|
||||||
)
|
)
|
||||||
|
|
||||||
def _send_invalidation_to_replication(self, txn, cache_name, keys):
|
def _send_invalidation_to_replication(self, txn, cache_name, keys):
|
||||||
|
Loading…
Reference in New Issue
Block a user