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

Commit 7b0e311

Browse files
committed
Always ensure we return a value for every user in get_rooms_for_users
The cached list (sensibly) requires that every input value has a corresponding output.
1 parent bd70af9 commit 7b0e311

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

synapse/storage/databases/main/roommember.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
import logging
16-
from collections import defaultdict
1716
from typing import (
1817
TYPE_CHECKING,
1918
Collection,
@@ -696,7 +695,8 @@ async def get_rooms_for_users(
696695
desc="get_rooms_for_users",
697696
)
698697

699-
user_rooms: Dict[str, Set[str]] = defaultdict(set)
698+
user_rooms: Dict[str, Set[str]] = {user_id: set() for user_id in user_ids}
699+
700700
for row in rows:
701701
user_rooms[row["state_key"]].add(row["room_id"])
702702

0 commit comments

Comments
 (0)