Skip to content

Commit

Permalink
fix: make internal rst_stream errors retriable (#699)
Browse files Browse the repository at this point in the history
* fix: make internal rst_stream errors retriable

* catch more rst stream variants
  • Loading branch information
igorbernstein2 committed Nov 18, 2022
1 parent c707c30 commit 770feb8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion google/cloud/bigtable/row_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import copy
import time

import google.api_core.exceptions
import six

import grpc
Expand Down Expand Up @@ -507,7 +508,15 @@ def _read_next(self):
try:
return six.next(self.response_iterator)
except grpc.RpcError as grpc_error:
raise exceptions.from_grpc_error(grpc_error)
# TODO: this needs to be moved to a more general location (ie interceptor)
e = exceptions.from_grpc_error(grpc_error)
# Sometimes GOAWAYs are surfaced as INTERNAL errors, which makes
# them unretriable. This patches that behavior
if e.grpc_status_code == grpc.StatusCode.INTERNAL and (
"rst_stream" in e.message.lower() or "rst stream" in e.message.lower()
):
raise google.api_core.exceptions.ServiceUnavailable(e.message)
raise e

def _read_next_response(self):
"""Helper for :meth:`__iter__`."""
Expand Down

0 comments on commit 770feb8

Please sign in to comment.