From 1a0c241ff712e0f3fec4191566d41d7d6b2943e1 Mon Sep 17 00:00:00 2001 From: Avery Date: Tue, 2 Jul 2024 09:58:51 -0700 Subject: [PATCH] Don't retry adding users if they are already in the channel. (#4906) --- src/dispatch/plugins/dispatch_slack/service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dispatch/plugins/dispatch_slack/service.py b/src/dispatch/plugins/dispatch_slack/service.py index e1c29355ee3f..6ba63a911495 100644 --- a/src/dispatch/plugins/dispatch_slack/service.py +++ b/src/dispatch/plugins/dispatch_slack/service.py @@ -103,6 +103,9 @@ def should_retry(exception: Exception) -> bool: """ match exception: case SlackApiError(): + # Don't retry for re-adding users in channel. + if exception.response["error"] == SlackAPIErrorCode.USER_IN_CHANNEL: + return False # Retry if it's not a fatal error return exception.response["error"] != SlackAPIErrorCode.FATAL_ERROR case TimeoutError() | Timeout():