mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
parent
c913e440c0
commit
9d2823ab70
1
changelog.d/13693.misc
Normal file
1
changelog.d/13693.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Add cache to `is_partial_state_room`.
|
@ -1185,8 +1185,9 @@ class RoomWorkerStore(CacheInvalidationWorkerStore):
|
|||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@staticmethod
|
def _clear_partial_state_room_txn(
|
||||||
def _clear_partial_state_room_txn(txn: LoggingTransaction, room_id: str) -> None:
|
self, txn: LoggingTransaction, room_id: str
|
||||||
|
) -> None:
|
||||||
DatabasePool.simple_delete_txn(
|
DatabasePool.simple_delete_txn(
|
||||||
txn,
|
txn,
|
||||||
table="partial_state_rooms_servers",
|
table="partial_state_rooms_servers",
|
||||||
@ -1197,7 +1198,9 @@ class RoomWorkerStore(CacheInvalidationWorkerStore):
|
|||||||
table="partial_state_rooms",
|
table="partial_state_rooms",
|
||||||
keyvalues={"room_id": room_id},
|
keyvalues={"room_id": room_id},
|
||||||
)
|
)
|
||||||
|
self._invalidate_cache_and_stream(txn, self.is_partial_state_room, (room_id,))
|
||||||
|
|
||||||
|
@cached()
|
||||||
async def is_partial_state_room(self, room_id: str) -> bool:
|
async def is_partial_state_room(self, room_id: str) -> bool:
|
||||||
"""Checks if this room has partial state.
|
"""Checks if this room has partial state.
|
||||||
|
|
||||||
@ -1771,9 +1774,8 @@ class RoomStore(RoomBackgroundUpdateStore, RoomWorkerStore):
|
|||||||
servers,
|
servers,
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _store_partial_state_room_txn(
|
def _store_partial_state_room_txn(
|
||||||
txn: LoggingTransaction, room_id: str, servers: Collection[str]
|
self, txn: LoggingTransaction, room_id: str, servers: Collection[str]
|
||||||
) -> None:
|
) -> None:
|
||||||
DatabasePool.simple_insert_txn(
|
DatabasePool.simple_insert_txn(
|
||||||
txn,
|
txn,
|
||||||
@ -1788,6 +1790,7 @@ class RoomStore(RoomBackgroundUpdateStore, RoomWorkerStore):
|
|||||||
keys=("room_id", "server_name"),
|
keys=("room_id", "server_name"),
|
||||||
values=((room_id, s) for s in servers),
|
values=((room_id, s) for s in servers),
|
||||||
)
|
)
|
||||||
|
self._invalidate_cache_and_stream(txn, self.is_partial_state_room, (room_id,))
|
||||||
|
|
||||||
async def maybe_store_room_on_outlier_membership(
|
async def maybe_store_room_on_outlier_membership(
|
||||||
self, room_id: str, room_version: RoomVersion
|
self, room_id: str, room_version: RoomVersion
|
||||||
|
Loading…
Reference in New Issue
Block a user