mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
suppress error by overriding class func (#8431)
This commit is contained in:
parent
aefecad4c0
commit
fc36be4f88
@ -1,5 +1,6 @@
|
|||||||
"""Websocket communicator."""
|
"""Websocket communicator."""
|
||||||
|
|
||||||
|
import errno
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
@ -12,7 +13,7 @@ from ws4py.server.wsgirefserver import (
|
|||||||
WSGIServer,
|
WSGIServer,
|
||||||
)
|
)
|
||||||
from ws4py.server.wsgiutils import WebSocketWSGIApplication
|
from ws4py.server.wsgiutils import WebSocketWSGIApplication
|
||||||
from ws4py.websocket import WebSocket
|
from ws4py.websocket import WebSocket as WebSocket_
|
||||||
|
|
||||||
from frigate.comms.dispatcher import Communicator
|
from frigate.comms.dispatcher import Communicator
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
@ -20,6 +21,18 @@ from frigate.config import FrigateConfig
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class WebSocket(WebSocket_):
|
||||||
|
def unhandled_error(self, error):
|
||||||
|
"""
|
||||||
|
Handles the unfriendly socket closures on the server side
|
||||||
|
without showing a confusing error message
|
||||||
|
"""
|
||||||
|
if hasattr(error, "errno") and error.errno == errno.ECONNRESET:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
logging.getLogger("ws4py").exception("Failed to receive data")
|
||||||
|
|
||||||
|
|
||||||
class WebSocketClient(Communicator): # type: ignore[misc]
|
class WebSocketClient(Communicator): # type: ignore[misc]
|
||||||
"""Frigate wrapper for ws client."""
|
"""Frigate wrapper for ws client."""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user