From 8b837e1ea16a7bbd1f25d3fcba2464a064ab6f88 Mon Sep 17 00:00:00 2001 From: Mathieu Velten Date: Thu, 8 Jun 2023 17:15:08 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Eric Eastwood --- synapse/handlers/room_member.py | 2 ++ synapse/storage/databases/main/roommember.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py index 09fd567e3b..ec638a6805 100644 --- a/synapse/handlers/room_member.py +++ b/synapse/handlers/room_member.py @@ -309,6 +309,8 @@ class RoomMemberHandler(metaclass=abc.ABCMeta): # the table `current_state_events` and `get_current_state_events` is `None`. await self.store.forget(user_id, room_id) + # If everyone locally has left the room, then there is no reason for us to keep the + # room around and we automatically purge room after a little bit if self._purge_retention_period and await self.store.is_locally_forgotten_room( room_id ): diff --git a/synapse/storage/databases/main/roommember.py b/synapse/storage/databases/main/roommember.py index 406ecd263a..c3a20eb44a 100644 --- a/synapse/storage/databases/main/roommember.py +++ b/synapse/storage/databases/main/roommember.py @@ -1343,7 +1343,7 @@ class RoomMemberWorkerStore(EventsWorkerStore, CacheInvalidationWorkerStore): ) async def get_rooms_to_purge(self) -> List[Dict[str, Any]]: - """Returns all rooms to shutdown/purge. This includes those that has + """Returns all rooms to shutdown/purge. This includes those that have been interrupted by a stop/restart of synapse, but also scheduled ones like locally forgotten rooms. """