From c4af9e5697674f1f3011322427c4e80d07da1e1f Mon Sep 17 00:00:00 2001 From: Corey Krewson Date: Thu, 25 Apr 2024 16:57:33 -0500 Subject: [PATCH] Updated websocket disconnect to use try/except --- tethysapp/app_store/notifications.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tethysapp/app_store/notifications.py b/tethysapp/app_store/notifications.py index 52976d6..2bb418f 100644 --- a/tethysapp/app_store/notifications.py +++ b/tethysapp/app_store/notifications.py @@ -72,9 +72,11 @@ async def connect(self): async def disconnect(self, _): """Disconnects from the websocket consumer and removes a notifications group from the channel""" - if "notifications" in self.channel_layer.groups: + try: await self.channel_layer.group_discard("notifications", self.channel_name) logger.info(f"Removed {self.channel_name} channel from notifications") + except Exception as e: + logger.warning(e) async def install_notifications(self, event): """Sends a notification to the notifications group channel