Skip to content

Commit

Permalink
Grpcio 1.34.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
peevo committed Jan 19, 2021
1 parent 4a5461d commit d3bc894
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions yandexcloud/_retry_interceptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@


class _ClientCallDetails(
collections.namedtuple(
'_ClientCallDetails',
('method', 'timeout', 'metadata', 'credentials', 'wait_for_ready')),
collections.namedtuple('_ClientCallDetails',
('method', 'timeout', 'metadata', 'credentials',
'wait_for_ready', 'compression')),
grpc.ClientCallDetails):
pass

Expand Down Expand Up @@ -137,10 +137,14 @@ def retry():
@staticmethod
def __adjust_timeout(client_call_details, deadline):
timeout = max(deadline - time.time(), 0.)

return _ClientCallDetails(
client_call_details.method, timeout, client_call_details.metadata,
client_call_details.credentials, client_call_details.wait_for_ready)
client_call_details.method,
timeout,
client_call_details.metadata,
client_call_details.credentials,
getattr(client_call_details, 'wait_for_ready', None),
getattr(client_call_details, 'compression', None),
)

def __add_idempotency_token(self, client_call_details):
return self.__append_metadata(client_call_details, self._IDEMPOTENCY_TOKEN_METADATA_KEY, str(uuid.uuid4()))
Expand All @@ -164,7 +168,11 @@ def __append_metadata(client_call_details, header, value, force=False):
header,
value,
))

return _ClientCallDetails(
client_call_details.method, client_call_details.timeout, metadata,
client_call_details.credentials, client_call_details.wait_for_ready)
client_call_details.method,
client_call_details.timeout,
metadata,
client_call_details.credentials,
getattr(client_call_details, 'wait_for_ready', None),
getattr(client_call_details, 'compression', None),
)

0 comments on commit d3bc894

Please sign in to comment.