From ecd160dddcbfb8102583607545f133a317742f75 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Mon, 20 Jan 2025 13:44:11 +0000 Subject: [PATCH] fix(slack source): Add retries to pulling information from DataHub --- .../src/datahub/ingestion/source/slack/slack.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/metadata-ingestion/src/datahub/ingestion/source/slack/slack.py b/metadata-ingestion/src/datahub/ingestion/source/slack/slack.py index 00b783a89774c..26ca525536c22 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/slack/slack.py +++ b/metadata-ingestion/src/datahub/ingestion/source/slack/slack.py @@ -2,6 +2,8 @@ import textwrap from dataclasses import dataclass from typing import Iterable, List, Optional, Tuple +from tenacity import retry, wait_exponential +from tenacity.before_sleep import before_sleep_log from pydantic import Field, SecretStr from slack_sdk import WebClient @@ -294,6 +296,10 @@ def populate_slack_id_from_email(self, user_obj: CorpUser) -> None: return raise e + @retry( + wait=wait_exponential(multiplier=2, min=4, max=60), + before_sleep=before_sleep_log(logger, logging.ERROR, True) + ) def get_user_to_be_updated(self) -> Iterable[CorpUser]: graphql_query = textwrap.dedent( """