From: Benjamin Braatz Date: Thu, 29 Jul 2021 22:17:31 +0000 (+0200) Subject: Catch CancelledError for connections. X-Git-Tag: v0.3.0~17 X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=f198c1c490fe887cb9701bae33ed0d96a3855bd9;p=graphit%2Fcontrolpi-wsserver.git Catch CancelledError for connections. --- 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: