bigquery: retry on 503
This code is returned from Google's DOS protection service. Exponentially
backing off should mitigate.
Fixes
@@ -147,7 +147,10 @@ func runWithRetry(ctx context.Context, call func() error) error {
})
}
-// This is the correct definition of retryable according to the BigQuery team.
+// This is the correct definition of retryable according to the BigQuery team. It
+// also considers 502 ("Bad Gateway") and 503 ("Service Unavailable") errors
+// retryable; these are returned by systems between the client and the BigQuery
+// service.
func retryableError(err error) bool {
e, ok := err.(*googleapi.Error)
if !ok {
@@ -157,5 +160,5 @@ func retryableError(err error) bool {
if len(e.Errors) > 0 {
reason = e.Errors[0].Reason
}
- return e.Code == http.StatusBadGateway || reason == "backendError" || reason == "rateLimitExceeded"
+ return e.Code == http.StatusServiceUnavailable || e.Code == http.StatusBadGateway || reason == "backendError" || reason == "rateLimitExceeded"
}
