remove room without listeners from Notifier.room_to_user_streams (#18380)

Co-authored-by: Andrew Morgan <andrew@amorgan.xyz>
This commit is contained in:
Stanislav Kazantsev 2025-05-15 23:18:17 +06:00 committed by GitHub
parent 44ae5362fd
commit 0afdc0fc7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

1
changelog.d/18380.misc Normal file
View File

@ -0,0 +1 @@
Fix a memory leak in `_NotifierUserStream`.

View File

@ -158,6 +158,9 @@ class _NotifierUserStream:
lst = notifier.room_to_user_streams.get(room, set())
lst.discard(self)
if not lst:
notifier.room_to_user_streams.pop(room, None)
notifier.user_to_user_stream.pop(self.user_id)
def count_listeners(self) -> int: