From f198c1c490fe887cb9701bae33ed0d96a3855bd9 Mon Sep 17 00:00:00 2001 From: Benjamin Braatz Date: Fri, 30 Jul 2021 00:17:31 +0200 Subject: [PATCH] Catch CancelledError for connections. --- controlpi_plugins/wsserver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controlpi_plugins/wsserver.py b/controlpi_plugins/wsserver.py index 7d38a08..981f7e2 100644 --- a/controlpi_plugins/wsserver.py +++ b/controlpi_plugins/wsserver.py @@ -126,7 +126,10 @@ class WSServer(BasePlugin): async def _handler(self, websocket: WebSocketServerProtocol, path: str) -> None: connection = Connection(self.bus, websocket) - await connection.run() + try: + await connection.run() + except asyncio.CancelledError: + pass async def _process_request(self, path: str, request_headers: Headers) -> Response: -- 2.34.1