Ignore OSError when closing websocket

This commit is contained in:
grossmj
2021-12-08 00:00:54 +10:30
parent af9860f965
commit 01a9e83f08
3 changed files with 12 additions and 4 deletions

View File

@ -78,8 +78,10 @@ async def notification_ws(websocket: WebSocket) -> None:
except WebSocketException as e:
log.warning(f"Error while sending to controller event to WebSocket client: {e}")
finally:
await websocket.close()
try:
await websocket.close()
except OSError:
pass # ignore OSError: [Errno 107] Transport endpoint is not connected
if __name__ == "__main__":