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

Reduce DB load when forget on leave setting is disabled #16668

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/16668.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reduce DB load when forget on leave setting is disabled.
11 changes: 8 additions & 3 deletions synapse/handlers/room_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -2111,9 +2111,14 @@ async def _unsafe_process(self) -> None:
self.pos = room_max_stream_ordering

if not self._hs.config.room.forget_on_leave:
# Update the processing position, so that if the server admin turns the
# feature on at a later date, we don't decide to forget every room that
# has ever been left in the past.
# Update the processing position, so that if the server admin turns
# the feature on at a later date, we don't decide to forget every
# room that has ever been left in the past.
#
# We wait for a short time so that we don't "tight" loop just
# keeping the table up to date.
await self._clock.sleep(0.5)

self.pos = self._store.get_room_max_stream_ordering()
await self._store.update_room_forgetter_stream_pos(self.pos)
return
Expand Down
Loading