Skip to content

Commit

Permalink
Updated websocket disconnect to use try/except
Browse files Browse the repository at this point in the history
  • Loading branch information
ckrew committed Apr 25, 2024
1 parent 721c456 commit c4af9e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tethysapp/app_store/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c4af9e5

Please sign in to comment.