Skip to content

Commit

Permalink
Don't retry adding users if they are already in the channel. (#4906)
Browse files Browse the repository at this point in the history
  • Loading branch information
metroid-samus authored Jul 2, 2024
1 parent 9d1f892 commit 1a0c241
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dispatch/plugins/dispatch_slack/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 1a0c241

Please sign in to comment.