Skip to content

Commit b297e18

Browse files
committed
add additional retryable errors
1 parent c85a5a3 commit b297e18

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/idp_common_pkg/idp_common/utils/bedrock_utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,21 @@ def async_exponential_backoff_retry[T, **P](
3030
max_delay: float = 32.0,
3131
exponential_base: float = 2.0,
3232
jitter: float = 0.1,
33-
retryable_errors: list[str] | None = None,
33+
retryable_errors: set[str] | None = None,
3434
) -> Callable[[Callable[P, Awaitable[T]]], Callable[P, Awaitable[T]]]:
3535
if not retryable_errors:
36-
retryable_errors = [
36+
retryable_errors = set( [
3737
"ThrottlingException",
3838
"throttlingException",
3939
"ModelErrorException",
4040
"ValidationException",
41-
]
41+
"ServiceQuotaExceededException",
42+
"RequestLimitExceeded",
43+
"TooManyRequestsException",
44+
"ServiceUnavailableException",
45+
"RequestTimeout",
46+
"RequestTimeoutException",
47+
] )
4248

4349
def decorator(func: Callable[P, Awaitable[T]]) -> Callable[P, Awaitable[T]]:
4450
@wraps(func)

0 commit comments

Comments
 (0)