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

Commit 3f5992f

Browse files
committed
Invalidate the cache
1 parent 11d2a9d commit 3f5992f

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

synapse/push/bulk_push_rule_evaluator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ async def _update_rules_with_member_event_ids(
506506
member_event_ids.values()
507507
)
508508

509-
# If the event is a join event then it will be in current state evnts
509+
# If the event is a join event then it will be in current state events
510510
# map but not in the DB, so we have to explicitly insert it.
511511
if event.type == EventTypes.Member:
512512
for event_id in member_event_ids.values():

synapse/storage/databases/main/cache.py

+4
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ def _invalidate_caches_for_event(
192192

193193
self.get_unread_event_push_actions_by_room_for_user.invalidate((room_id,))
194194

195+
# The `_get_membership_from_event_id` is immutable, except for the
196+
# case where we look up an event *before* persisting it.
197+
self._get_membership_from_event_id.invalidate((event_id,))
198+
195199
if not backfilled:
196200
self._events_stream_cache.entity_has_changed(room_id, stream_ordering)
197201

synapse/storage/databases/main/events.py

+7
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,13 @@ def non_null_str_or_none(val: Any) -> Optional[str]:
17451745
(event.state_key,),
17461746
)
17471747

1748+
# The `_get_joined_profile_from_event_id` is immutable, except for the
1749+
# case where we look up an event *before* persisting it.
1750+
txn.call_after(
1751+
self.store._get_membership_from_event_id.invalidate,
1752+
(event.event_id,),
1753+
)
1754+
17481755
# We update the local_current_membership table only if the event is
17491756
# "current", i.e., its something that has just happened.
17501757
#

0 commit comments

Comments
 (0)