File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
packages/google-cloud-ndb Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,11 @@ def retry_wrapper(*args, **kwargs):
9999# that a DEADLINE_EXCEEDED status code guarantees the operation was cancelled,
100100# then we can add DEADLINE_EXCEEDED to our retryable status codes. Not knowing
101101# the answer, it's best not to take that risk.
102- TRANSIENT_CODES = (grpc .StatusCode .UNAVAILABLE , grpc .StatusCode .INTERNAL )
102+ TRANSIENT_CODES = (
103+ grpc .StatusCode .UNAVAILABLE ,
104+ grpc .StatusCode .INTERNAL ,
105+ grpc .StatusCode .ABORTED ,
106+ )
103107
104108
105109def is_transient_error (error ):
Original file line number Diff line number Diff line change @@ -177,3 +177,11 @@ def test_unauthenticated(core_retry):
177177 core_retry .if_transient_error .return_value = False
178178 assert _retry .is_transient_error (error ) is False
179179 core_retry .if_transient_error .assert_called_once_with (error )
180+
181+ @staticmethod
182+ @mock .patch ("google.cloud.ndb._retry.core_retry" )
183+ def test_aborted (core_retry ):
184+ error = mock .Mock (code = mock .Mock (return_value = grpc .StatusCode .ABORTED ))
185+ core_retry .if_transient_error .return_value = False
186+ assert _retry .is_transient_error (error ) is True
187+ core_retry .if_transient_error .assert_called_once_with (error )
You can’t perform that action at this time.
0 commit comments