mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Invalidate caches properly. Remove unused arg
This commit is contained in:
parent
19fd425928
commit
e1941442d4
@ -128,9 +128,6 @@ class EventsStore(SQLBaseStore):
|
|||||||
is_new_state=is_new_state,
|
is_new_state=is_new_state,
|
||||||
current_state=current_state,
|
current_state=current_state,
|
||||||
)
|
)
|
||||||
self._events_stream_cache.room_has_changed(
|
|
||||||
None, event.room_id, stream_ordering
|
|
||||||
)
|
|
||||||
except _RollbackButIsFineException:
|
except _RollbackButIsFineException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -213,6 +210,12 @@ class EventsStore(SQLBaseStore):
|
|||||||
for event, _ in events_and_contexts:
|
for event, _ in events_and_contexts:
|
||||||
txn.call_after(self._invalidate_get_event_cache, event.event_id)
|
txn.call_after(self._invalidate_get_event_cache, event.event_id)
|
||||||
|
|
||||||
|
if not backfilled:
|
||||||
|
txn.call_after(
|
||||||
|
self._events_stream_cache.room_has_changed,
|
||||||
|
event.room_id, event.internal_metadata.stream_ordering,
|
||||||
|
)
|
||||||
|
|
||||||
depth_updates = {}
|
depth_updates = {}
|
||||||
for event, _ in events_and_contexts:
|
for event, _ in events_and_contexts:
|
||||||
if event.internal_metadata.is_outlier():
|
if event.internal_metadata.is_outlier():
|
||||||
|
@ -78,7 +78,7 @@ class ReceiptsStore(SQLBaseStore):
|
|||||||
|
|
||||||
if from_key:
|
if from_key:
|
||||||
room_ids = yield self._receipts_stream_cache.get_rooms_changed(
|
room_ids = yield self._receipts_stream_cache.get_rooms_changed(
|
||||||
self, room_ids, from_key
|
room_ids, from_key
|
||||||
)
|
)
|
||||||
|
|
||||||
results = yield self._get_linearized_receipts_for_rooms(
|
results = yield self._get_linearized_receipts_for_rooms(
|
||||||
@ -221,6 +221,11 @@ class ReceiptsStore(SQLBaseStore):
|
|||||||
# FIXME: This shouldn't invalidate the whole cache
|
# FIXME: This shouldn't invalidate the whole cache
|
||||||
txn.call_after(self.get_linearized_receipts_for_room.invalidate_all)
|
txn.call_after(self.get_linearized_receipts_for_room.invalidate_all)
|
||||||
|
|
||||||
|
txn.call_after(
|
||||||
|
self._receipts_stream_cache.room_has_changed,
|
||||||
|
room_id, stream_id
|
||||||
|
)
|
||||||
|
|
||||||
# We don't want to clobber receipts for more recent events, so we
|
# We don't want to clobber receipts for more recent events, so we
|
||||||
# have to compare orderings of existing receipts
|
# have to compare orderings of existing receipts
|
||||||
sql = (
|
sql = (
|
||||||
@ -308,9 +313,6 @@ class ReceiptsStore(SQLBaseStore):
|
|||||||
|
|
||||||
stream_id_manager = yield self._receipts_id_gen.get_next(self)
|
stream_id_manager = yield self._receipts_id_gen.get_next(self)
|
||||||
with stream_id_manager as stream_id:
|
with stream_id_manager as stream_id:
|
||||||
yield self._receipts_stream_cache.room_has_changed(
|
|
||||||
self, room_id, stream_id
|
|
||||||
)
|
|
||||||
have_persisted = yield self.runInteraction(
|
have_persisted = yield self.runInteraction(
|
||||||
"insert_linearized_receipt",
|
"insert_linearized_receipt",
|
||||||
self.insert_linearized_receipt_txn,
|
self.insert_linearized_receipt_txn,
|
||||||
|
@ -169,7 +169,7 @@ class StreamStore(SQLBaseStore):
|
|||||||
from_id = RoomStreamToken.parse_stream_token(from_key).stream
|
from_id = RoomStreamToken.parse_stream_token(from_key).stream
|
||||||
|
|
||||||
room_ids = yield self._events_stream_cache.get_rooms_changed(
|
room_ids = yield self._events_stream_cache.get_rooms_changed(
|
||||||
self, room_ids, from_id
|
room_ids, from_id
|
||||||
)
|
)
|
||||||
|
|
||||||
if not room_ids:
|
if not room_ids:
|
||||||
|
@ -51,7 +51,7 @@ class RoomStreamChangeCache(object):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_rooms_changed(self, store, room_ids, key):
|
def get_rooms_changed(self, room_ids, key):
|
||||||
"""Returns subset of room ids that have had new things since the
|
"""Returns subset of room ids that have had new things since the
|
||||||
given key. If the key is too old it will just return the given list.
|
given key. If the key is too old it will just return the given list.
|
||||||
"""
|
"""
|
||||||
@ -70,7 +70,7 @@ class RoomStreamChangeCache(object):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def room_has_changed(self, store, room_id, key):
|
def room_has_changed(self, room_id, key):
|
||||||
"""Informs the cache that the room has been changed at the given key.
|
"""Informs the cache that the room has been changed at the given key.
|
||||||
"""
|
"""
|
||||||
if key > self._earliest_known_key:
|
if key > self._earliest_known_key:
|
||||||
|
Loading…
Reference in New Issue
Block a user