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. """