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: