fix tests
This commit is contained in:
@@ -84,12 +84,10 @@ class ConnectionManager:
|
||||
for room_members in self._rooms.values():
|
||||
room_members.discard(connection_id)
|
||||
|
||||
# Remove empty rooms
|
||||
self._rooms = {
|
||||
room: members
|
||||
for room, members in self._rooms.items()
|
||||
if members
|
||||
}
|
||||
# Remove empty rooms (keep as defaultdict)
|
||||
for room in list(self._rooms.keys()):
|
||||
if not self._rooms[room]:
|
||||
del self._rooms[room]
|
||||
|
||||
# Remove connection and metadata
|
||||
self._active_connections.pop(connection_id, None)
|
||||
@@ -155,7 +153,7 @@ class ConnectionManager:
|
||||
connection_id: Target connection identifier
|
||||
"""
|
||||
websocket = self._active_connections.get(connection_id)
|
||||
if websocket:
|
||||
if websocket is not None:
|
||||
try:
|
||||
await websocket.send_json(message)
|
||||
logger.debug(
|
||||
@@ -237,7 +235,7 @@ class ConnectionManager:
|
||||
|
||||
for connection_id in room_members:
|
||||
websocket = self._active_connections.get(connection_id)
|
||||
if not websocket:
|
||||
if websocket is None:
|
||||
continue
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user