arpy8 commited on
Commit
35bb69a
·
1 Parent(s): 1da04be

Disable logging for WebSocket servers and refine error handling in handle_client function

Browse files
Files changed (1) hide show
  1. main.py +2 -1
main.py CHANGED
@@ -23,6 +23,8 @@ import logging
23
  logging.basicConfig(level=logging.INFO)
24
  logging.getLogger('websockets.server').setLevel(logging.WARNING)
25
  logging.getLogger('websockets.asyncio.server').setLevel(logging.WARNING)
 
 
26
 
27
  # Configuration
28
  STT_MODEL_SIZE = "base"
@@ -278,7 +280,6 @@ async def handle_client(websocket):
278
  if client_id:
279
  print(f"Client {client_id} disconnected")
280
  except Exception as e:
281
- # Only log if it's not a handshake error
282
  if not isinstance(e, (websockets.exceptions.InvalidMessage, EOFError)):
283
  print(f"Connection error: {e}")
284
 
 
23
  logging.basicConfig(level=logging.INFO)
24
  logging.getLogger('websockets.server').setLevel(logging.WARNING)
25
  logging.getLogger('websockets.asyncio.server').setLevel(logging.WARNING)
26
+ logging.getLogger('websockets.server').disabled = True
27
+ logging.getLogger('websockets.asyncio.server').disabled = True
28
 
29
  # Configuration
30
  STT_MODEL_SIZE = "base"
 
280
  if client_id:
281
  print(f"Client {client_id} disconnected")
282
  except Exception as e:
 
283
  if not isinstance(e, (websockets.exceptions.InvalidMessage, EOFError)):
284
  print(f"Connection error: {e}")
285