Skip to content

Commit b8b5020

Browse files
committed
add except
1 parent 801d144 commit b8b5020

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ansible_api/realtimemsg.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ async def send(data):
3737
if group in RealTimeMessage.UserList:
3838
for ws in RealTimeMessage.UserList.get(group, []):
3939
if ws.open:
40-
await ws.send(json.dumps(msg))
40+
try:
41+
await ws.send(json.dumps(msg))
42+
# FOR websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1006
43+
except BaseException as e:
44+
Tool.LOGGER.exception(e)
4145
else:
4246
# WSUser.UserList = [u for u in WSUser.UserList if u != x]
4347
RealTimeMessage.UserList.get(group).remove(ws)

0 commit comments

Comments
 (0)