From ad6a2b9e0cc006d68d3abf7d1b5d014681ccdbe3 Mon Sep 17 00:00:00 2001 From: Kegan Dougal <7190048+kegsay@users.noreply.github.com> Date: Wed, 24 Sep 2025 12:45:22 +0100 Subject: [PATCH] Update docs to not lie --- synapse/storage/databases/main/events.py | 4 ++-- synapse/storage/databases/main/sticky_events.py | 15 +++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py index ab9fbc4a1c..439bdafdae 100644 --- a/synapse/storage/databases/main/events.py +++ b/synapse/storage/databases/main/events.py @@ -379,8 +379,8 @@ class PersistEventsStore: # re-evaluation, so it can't do that without leaking out the txn currently, hence it # now just lives outside. if self.msc4354_sticky_events: - # process events which are sticky as well as re-evaluate soft-failed sticky events. - await self.store.handle_sticky_events( + # re-evaluate soft-failed sticky events. + await self.store.reevaluate_soft_failed_sticky_events( room_id, events_and_contexts, state_delta_for_room, diff --git a/synapse/storage/databases/main/sticky_events.py b/synapse/storage/databases/main/sticky_events.py index e9a45bcf4e..2f04623a86 100644 --- a/synapse/storage/databases/main/sticky_events.py +++ b/synapse/storage/databases/main/sticky_events.py @@ -209,26 +209,17 @@ class StickyEventsWorkerStore(StateGroupWorkerStore, CacheInvalidationWorkerStor ) return cast(List[Tuple[int, str, str]], txn.fetchall()) - async def handle_sticky_events( + async def reevaluate_soft_failed_sticky_events( self, room_id: str, events_and_contexts: List[EventPersistencePair], state_delta_for_room: Optional[DeltaState], ) -> None: - """Update the sticky events table, used in MSC4354. Intended to be called after the persist - events transaction. - - This function assumes that `_store_event_txn()` (to persist the event) and - `_update_current_state_txn(...)` (so the current state has taken the events into account) - have already been run. - - "Handling" sticky events is broken into two phases: - - for each sticky event in events_and_contexts, mark them as sticky in the sticky events table. - - for each still-sticky soft-failed event in the room, re-evaluate soft-failedness. + """Re-evaluate soft failed events in the room provided. Args: room_id: The room that all of the events belong to - events_and_contexts: The events being persisted. + events_and_contexts: The events just persisted. These are not eligible for re-evaluation. state_delta_for_room: The changes to the current state, used to detect if we need to re-evaluate soft-failed sticky events. """