Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Slack error code skip retry #4912

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/dispatch/plugins/dispatch_slack/incident/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,10 @@ def handle_after_hours_message(
participant = participant_service.get_by_incident_id_and_email(
db_session=db_session, incident_id=context["subject"].id, email=user.email
)
# handle no participant found
if not participant:
return

# get their timezone from slack
try:
owner_tz = (dispatch_slack_service.get_user_info_by_email(client, email=owner_email))["tz"]
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch/plugins/dispatch_slack/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ 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:
if exception.response["error"] in [SlackAPIErrorCode.USER_IN_CHANNEL, SlackAPIErrorCode.ALREADY_IN_CHANNEL]:
return False
# Retry if it's not a fatal error
return exception.response["error"] != SlackAPIErrorCode.FATAL_ERROR
Expand Down
Loading