Skip to content

Commit e94d496

Browse files
JohnEmhoffdanielhochman
authored andcommitted
Apply retry to ProvisionedThroughputExceeded (#222)
1 parent 4dddef0 commit e94d496

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pynamodb/connection/base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,10 @@ def _make_api_call(self, operation_name, operation_kwargs):
332332
if is_last_attempt_for_exceptions:
333333
log.debug('Reached the maximum number of retry attempts: %s', attempt_number)
334334
raise
335-
elif response.status_code < 500:
336-
# We don't retry on a ConditionalCheckFailedException or other 4xx because we assume they will
337-
# fail in perpetuity. Retrying when there is already contention could cause other problems
335+
elif response.status_code < 500 and code != 'ProvisionedThroughputExceededException':
336+
# We don't retry on a ConditionalCheckFailedException or other 4xx (except for
337+
# throughput related errors) because we assume they will fail in perpetuity.
338+
# Retrying when there is already contention could cause other problems
338339
# in part due to unnecessary consumption of throughput.
339340
raise
340341
else:

0 commit comments

Comments
 (0)