Skip to content

Commit

Permalink
Changes based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgliss committed Jun 26, 2024
1 parent 42dd88b commit 5006734
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/dispatch/plugins/dispatch_slack/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@


class SlackRetryException(Exception):
def __init__(self, wait_time):
def __init__(self, wait_time: int = None):
self.wait_time = wait_time
super().__init__(f"Retrying slack call in {wait_time} seconds.")
if wait_time is None:
super().__init__(f"Retrying slack call in {wait_time} seconds.")
else:
super().__init__("Retrying slack call.")

def get_wait_time(self) -> float:
def get_wait_time(self) -> int:
return self.wait_time

def slack_wait_strategy(retry_state: RetryCallState) -> float:
"""Determines the wait time for the Slack retry strategy"""
exc = retry_state.outcome.exception()
if isinstance(exc, SlackRetryException):

if exc.get_wait_time():
return exc.get_wait_time()

# Fallback to exponential backoff if no custom wait time is specified
Expand Down

0 comments on commit 5006734

Please sign in to comment.