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

Fix potential leak of per-room profiles when the user dir is rebuilt. #10981

Merged
merged 9 commits into from
Oct 5, 2021
Merged
Changes from 1 commit
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
13 changes: 5 additions & 8 deletions synapse/storage/databases/main/user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,18 +248,15 @@ def _get_next_batch(
)

# Now update the room sharing tables to include this room.
to_insert = set()
is_public = await self.is_room_world_readable_or_publicly_joinable(
room_id
)
if is_public:
for user_id in users_with_profile:
to_insert.add(user_id)

if to_insert:
await self.add_users_in_public_rooms(room_id, to_insert)
to_insert.clear()
if is_public and users_with_profile:
await self.add_users_in_public_rooms(
room_id, users_with_profile.keys()
)
else:
to_insert = set()
for user_id in users_with_profile:
# We want the set of pairs (L, M) where L and M are
# in `users_with_profile` and L is local.
Expand Down