From 88ebd87e1eda318b28dd11aa730e86a1929f5b08 Mon Sep 17 00:00:00 2001 From: Kazuhiro Sera Date: Wed, 28 Feb 2024 10:25:22 +0900 Subject: [PATCH] Fix #1462 websocket_client-based SocketModeClient does not reconnect after a DNS outage --- slack_sdk/socket_mode/websocket_client/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/slack_sdk/socket_mode/websocket_client/__init__.py b/slack_sdk/socket_mode/websocket_client/__init__.py index 3f22b36d..faa7fdd6 100644 --- a/slack_sdk/socket_mode/websocket_client/__init__.py +++ b/slack_sdk/socket_mode/websocket_client/__init__.py @@ -244,6 +244,9 @@ def _run_current_session(self): self.logger.info("Stopped receiving messages from a connection") except Exception as e: self.logger.exception(f"Failed to start or stop the current session: {e}") + # To let the monitoring job detect the connection issue, closing this session + if self.current_session is not None: + self.current_session.close() def _monitor_current_session(self): if self.current_app_monitor_started: