File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,9 @@ def if_exception_type_predicate(exception):
98
98
# Pylint sees this as a constant, but it is also an alias that should be
99
99
# considered a function.
100
100
if_transient_error = if_exception_type (
101
- (exceptions .InternalServerError , exceptions .TooManyRequests )
101
+ exceptions .InternalServerError ,
102
+ exceptions .TooManyRequests ,
103
+ exceptions .ServiceUnavailable ,
102
104
)
103
105
"""A predicate that checks if an exception is a transient API error.
104
106
@@ -107,6 +109,7 @@ def if_exception_type_predicate(exception):
107
109
- :class:`google.api_core.exceptions.InternalServerError` - HTTP 500, gRPC
108
110
``INTERNAL(13)`` and its subclasses.
109
111
- :class:`google.api_core.exceptions.TooManyRequests` - HTTP 429
112
+ - :class:`google.api_core.exceptions.ServiceUnavailable` - HTTP 503
110
113
- :class:`google.api_core.exceptions.ResourceExhausted` - gRPC
111
114
``RESOURCE_EXHAUSTED(8)``
112
115
"""
Original file line number Diff line number Diff line change 39
39
'futures >= 3.2.0; python_version < "3.2"' ,
40
40
]
41
41
extras = {
42
- "grpc" : "grpcio >= 1.8.2" ,
42
+ "grpc" : "grpcio >= 1.8.2, < 2.0dev " ,
43
43
"grpcgcp" : "grpcio-gcp >= 0.2.2" ,
44
44
"grpcio-gcp" : "grpcio-gcp >= 0.2.2" ,
45
45
}
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ def test_if_exception_type_multiple():
41
41
def test_if_transient_error ():
42
42
assert retry .if_transient_error (exceptions .InternalServerError ("" ))
43
43
assert retry .if_transient_error (exceptions .TooManyRequests ("" ))
44
+ assert retry .if_transient_error (exceptions .ServiceUnavailable ("" ))
44
45
assert not retry .if_transient_error (exceptions .InvalidArgument ("" ))
45
46
46
47
You can’t perform that action at this time.
0 commit comments