Skip to content

Commit 0afdc0f

Browse files
remove room without listeners from Notifier.room_to_user_streams (#18380)
Co-authored-by: Andrew Morgan <andrew@amorgan.xyz>
1 parent 44ae536 commit 0afdc0f

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

changelog.d/18380.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a memory leak in `_NotifierUserStream`.

synapse/notifier.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ def remove(self, notifier: "Notifier") -> None:
158158
lst = notifier.room_to_user_streams.get(room, set())
159159
lst.discard(self)
160160

161+
if not lst:
162+
notifier.room_to_user_streams.pop(room, None)
163+
161164
notifier.user_to_user_stream.pop(self.user_id)
162165

163166
def count_listeners(self) -> int:

0 commit comments

Comments
 (0)