Skip to content

Commit 3e021a4

Browse files
authored
feat: widen retry predicate to include ServiceUnavailable (#1641)
Expands retry. It's possible in the normal lifecycle of an API frontend for the intermediate response to indicate the API service is not ready. related: internal issue 294103068
1 parent b0199f2 commit 3e021a4

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

google/cloud/bigquery/retry.py

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
exceptions.TooManyRequests,
2828
exceptions.InternalServerError,
2929
exceptions.BadGateway,
30+
exceptions.ServiceUnavailable,
3031
requests.exceptions.ChunkedEncodingError,
3132
requests.exceptions.ConnectionError,
3233
requests.exceptions.Timeout,

tests/unit/test_retry.py

+6
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ def test_w_unstructured_too_many_requests(self):
7979
exc = TooManyRequests("testing")
8080
self.assertTrue(self._call_fut(exc))
8181

82+
def test_w_unstructured_service_unavailable(self):
83+
from google.api_core.exceptions import ServiceUnavailable
84+
85+
exc = ServiceUnavailable("testing")
86+
self.assertTrue(self._call_fut(exc))
87+
8288
def test_w_internalError(self):
8389
exc = mock.Mock(errors=[{"reason": "internalError"}], spec=["errors"])
8490
self.assertTrue(self._call_fut(exc))

0 commit comments

Comments
 (0)