You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
f"Caught retryable error '{str(exc)}' after {details['tries']} tries. Waiting {details['wait']} seconds then retrying..."
85
-
)
86
-
87
-
defshould_give_up(exc: Exception) ->bool:
88
-
# If made it here, the ResponseAction was RETRY and therefore should not give up
89
-
returnFalse
90
-
91
-
returnbackoff.on_exception( # type: ignore # Decorator function returns a function with a different signature than the input function, so mypy can't infer the type of the returned function
92
-
backoff.expo,
93
-
TRANSIENT_EXCEPTIONS,
94
-
jitter=None,
95
-
on_backoff=log_retry_attempt,
96
-
giveup=should_give_up,
97
-
max_tries=max_tries,
98
-
max_time=max_time,
99
-
**kwargs,
100
-
)
101
-
102
-
103
-
defuser_defined_backoff_handler(
104
-
max_tries: Optional[int], max_time: Optional[int] =None, **kwargs: Any
f"Max retry limit reached after {details['elapsed']:.1f}s. Request: {exc.request}, Response: {exc.response}"
126
-
)
127
-
else:
128
-
logger.error("Max retry limit reached for unknown request and response")
129
-
130
-
# Suppress the backoff library's default log that misleadingly reports interval (0s) instead of actual sleep time
131
-
kwargs.pop("logger", None)
132
-
133
-
returnbackoff.on_exception( # type: ignore # Decorator function returns a function with a different signature than the input function, so mypy can't infer the type of the returned function
134
-
backoff.constant,
135
-
UserDefinedBackoffException,
136
-
interval=0, # skip waiting, we'll wait in on_backoff handler
f"Caught retryable error '{str(exc)}' after {details['tries']} tries. Waiting {details['wait']} seconds then retrying..."
158
-
)
159
-
160
-
returnbackoff.on_exception( # type: ignore # Decorator function returns a function with a different signature than the input function, so mypy can't infer the type of the returned function
0 commit comments