Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion google/cloud/ndb/_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ def retry_wrapper(*args, **kwargs):
# that a DEADLINE_EXCEEDED status code guarantees the operation was cancelled,
# then we can add DEADLINE_EXCEEDED to our retryable status codes. Not knowing
# the answer, it's best not to take that risk.
TRANSIENT_CODES = (grpc.StatusCode.UNAVAILABLE, grpc.StatusCode.INTERNAL)
TRANSIENT_CODES = (
grpc.StatusCode.UNAVAILABLE,
grpc.StatusCode.INTERNAL,
grpc.StatusCode.ABORTED,
)


def is_transient_error(error):
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/test__retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,11 @@ def test_unauthenticated(core_retry):
core_retry.if_transient_error.return_value = False
assert _retry.is_transient_error(error) is False
core_retry.if_transient_error.assert_called_once_with(error)

@staticmethod
@mock.patch("google.cloud.ndb._retry.core_retry")
def test_aborted(core_retry):
error = mock.Mock(code=mock.Mock(return_value=grpc.StatusCode.ABORTED))
core_retry.if_transient_error.return_value = False
assert _retry.is_transient_error(error) is True
core_retry.if_transient_error.assert_called_once_with(error)