From 2d325025c8915af35406aede7543b72721850f86 Mon Sep 17 00:00:00 2001 From: Jason Schroth Date: Wed, 21 Feb 2024 11:29:57 -0800 Subject: [PATCH] handle network timeouts in slack make_call (#4428) Add try again for request timeouts to slack --- src/dispatch/plugins/dispatch_slack/service.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dispatch/plugins/dispatch_slack/service.py b/src/dispatch/plugins/dispatch_slack/service.py index 80ff827c3317..ed1a9d98e774 100644 --- a/src/dispatch/plugins/dispatch_slack/service.py +++ b/src/dispatch/plugins/dispatch_slack/service.py @@ -4,6 +4,7 @@ import heapq import logging +from requests import Timeout from slack_sdk.errors import SlackApiError from slack_sdk.web.client import WebClient from slack_sdk.web.slack_response import SlackResponse @@ -63,6 +64,10 @@ def make_call(client: WebClient, endpoint: str, **kwargs) -> SlackResponse: time.sleep(wait) raise TryAgain from None raise exception + except Timeout as exception: + log.warn(f"Timeout error {exception} for slack. Endpoint: {endpoint}. Kwargs: {kwargs}") + time.sleep(300) + raise TryAgain from None def list_conversation_messages(client: WebClient, conversation_id: str, **kwargs) -> SlackResponse: