From 7f287f049bddbeaefcadcc736163454925298352 Mon Sep 17 00:00:00 2001 From: Daniel Darabos Date: Tue, 10 Dec 2024 12:12:02 +0100 Subject: [PATCH] Remove client on failure. --- pycrdt_websocket/yroom.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pycrdt_websocket/yroom.py b/pycrdt_websocket/yroom.py index 6a9c2ec..d1f77de 100644 --- a/pycrdt_websocket/yroom.py +++ b/pycrdt_websocket/yroom.py @@ -309,10 +309,11 @@ async def serve(self, websocket: Websocket): tg.start_soon(client.send, message) # apply awareness update to the server's awareness self.awareness.apply_awareness_update(read_message(message[1:]), self) - # remove this client - self.clients.remove(websocket) except Exception as exception: self._handle_exception(exception) + finally: + # remove this client + self.clients.remove(websocket) def send_server_awareness(self, type: str, changes: tuple[dict[str, Any], Any]) -> None: """