Skip to content

Commit

Permalink
Merge pull request #122 fix check retriable for idempotent error
Browse files Browse the repository at this point in the history
  • Loading branch information
rekby authored Feb 6, 2023
2 parents 6e42c28 + 5b98a6f commit b3bd120
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Fix error of check retriable error for idempotent operations (error exist since 2.12.1)

## 2.12.1 ##
* Supported `TYPE_UNSPECIFIED` item type to scheme ls
* Fixed error while request iam token with bad content type in metadata
Expand Down
7 changes: 4 additions & 3 deletions ydb/_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ def check_retriable_error(err, retry_settings, attempt):

if retry_settings.idempotent:
for t in _errors_retriable_slow_backoff_idempotent_types:
return ErrorRetryInfo(
True, retry_settings.slow_backoff.calc_timeout(attempt)
)
if isinstance(err, t):
return ErrorRetryInfo(
True, retry_settings.slow_backoff.calc_timeout(attempt)
)

return ErrorRetryInfo(False, None)

Expand Down
5 changes: 5 additions & 0 deletions ydb/table_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,9 @@ def check_retriable_error(err_type, backoff):
check_retriable_error(issues.Unavailable, retry_once_settings.fast_backoff)

check_unretriable_error(issues.Error, True)
with mock.patch.object(retry_once_settings, "idempotent", True):
check_unretriable_error(issues.Error, True)

check_unretriable_error(TestException, False)
with mock.patch.object(retry_once_settings, "idempotent", True):
check_unretriable_error(TestException, False)

0 comments on commit b3bd120

Please sign in to comment.