Skip to content

Commit

Permalink
fix: retry when data connections query fails (#1517)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas1312 authored Oct 4, 2023
1 parent cb303d3 commit 0a75baf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/kili/core/graphql/graphql_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from tenacity import (
retry,
retry_all,
retry_any,
retry_if_exception_message,
retry_if_exception_type,
retry_if_not_exception_message,
Expand All @@ -40,6 +41,7 @@
from kili.utils.logcontext import LogContext

gql_requests_logger.setLevel(logging.WARNING)

# _limiter and _execute_lock must be kept at module-level
# they need to be shared between all instances of Kili client within the same process

Expand Down Expand Up @@ -285,7 +287,10 @@ def execute(
retry_if_not_exception_message(
match=r'.*Field "(\w+)" is not defined by type "(\w+)".*'
),
retry_if_exception_message(match=r".*Invalid request made to Flagsmith API.*"),
retry_any(
retry_if_exception_message(match=r".*Invalid request made to Flagsmith API.*"),
retry_if_exception_message(match=r".*Failed to fetch data connection.*"),
),
),
stop=stop_after_delay(3 * 60),
wait=wait_exponential(multiplier=0.5, min=1, max=10),
Expand Down

0 comments on commit 0a75baf

Please sign in to comment.