This repository was archived by the owner on Apr 26, 2024. It is now read-only.
File tree 1 file changed +6
-3
lines changed
synapse/storage/databases/main
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 15
15
import logging
16
16
from typing import (
17
17
TYPE_CHECKING ,
18
+ AbstractSet ,
18
19
Collection ,
19
20
Dict ,
20
21
FrozenSet ,
@@ -418,10 +419,12 @@ async def get_rooms_for_local_user_where_membership_is(
418
419
)
419
420
420
421
# Now we filter out forgotten and excluded rooms
421
- rooms_to_exclude : Set [ str ] = await self .get_forgotten_rooms_for_user (user_id )
422
+ rooms_to_exclude = await self .get_forgotten_rooms_for_user (user_id )
422
423
423
424
if excluded_rooms is not None :
424
- rooms_to_exclude .update (set (excluded_rooms ))
425
+ # Take a copy to avoid mutating the in-cache set
426
+ rooms_to_exclude = set (rooms_to_exclude )
427
+ rooms_to_exclude .update (excluded_rooms )
425
428
426
429
return [room for room in rooms if room .room_id not in rooms_to_exclude ]
427
430
@@ -1175,7 +1178,7 @@ def f(txn: LoggingTransaction) -> int:
1175
1178
return count == 0
1176
1179
1177
1180
@cached ()
1178
- async def get_forgotten_rooms_for_user (self , user_id : str ) -> Set [str ]:
1181
+ async def get_forgotten_rooms_for_user (self , user_id : str ) -> AbstractSet [str ]:
1179
1182
"""Gets all rooms the user has forgotten.
1180
1183
1181
1184
Args:
You can’t perform that action at this time.
0 commit comments