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

Commit

Permalink
Flag stream change cache after persisting events with new stream order
Browse files Browse the repository at this point in the history
This appears to have previously been done within the room depth handling
and only for local events.
  • Loading branch information
Fizzadar committed Oct 23, 2022
1 parent 93c781c commit 9b5ef68
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions synapse/storage/databases/main/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ def _persist_events_txn(
# NB: This function invalidates all state related caches
self._update_current_state_txn(txn, state_delta_for_room, min_stream_order)

# Flag the stream change cache for this room if we added non-backfilled events
if max_stream_order > 0:
for event, _ in events_and_contexts:
assert event.internal_metadata.stream_ordering is not None
self.store._events_stream_cache.entity_has_changed(
event.room_id, event.internal_metadata.stream_ordering
)

def _persist_event_auth_chain_txn(
self,
txn: LoggingTransaction,
Expand Down Expand Up @@ -1046,6 +1054,9 @@ async def update_current_state(
stream_id=stream_ordering,
)

# Flag the stream change cache for this room
self.store._events_stream_cache.entity_has_changed(room_id, stream_ordering)

def _update_current_state_txn(
self,
txn: LoggingTransaction,
Expand Down

0 comments on commit 9b5ef68

Please sign in to comment.