From 852128787eeea05f488677422373e13e700b10f1 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 1 Nov 2024 12:47:09 -0700 Subject: [PATCH] removed channel from _ping_and_warm_instances --- google/cloud/bigtable/data/_async/client.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/google/cloud/bigtable/data/_async/client.py b/google/cloud/bigtable/data/_async/client.py index 076070f35..c60ff4144 100644 --- a/google/cloud/bigtable/data/_async/client.py +++ b/google/cloud/bigtable/data/_async/client.py @@ -220,7 +220,7 @@ async def close(self, timeout: float = 2.0): self._channel_refresh_task = None async def _ping_and_warm_instances( - self, channel: grpc.aio.Channel, instance_key: _WarmedInstanceKey | None = None + self, instance_key: _WarmedInstanceKey | None = None ) -> list[BaseException | None]: """ Prepares the backend for requests on a channel @@ -228,7 +228,6 @@ async def _ping_and_warm_instances( Pings each Bigtable instance registered in `_active_instances` on the client Args: - channel: grpc channel to warm instance_key: if provided, only warm the instance associated with the key Returns: list[BaseException | None]: sequence of results or exceptions from the ping requests @@ -236,7 +235,7 @@ async def _ping_and_warm_instances( instance_list = ( [instance_key] if instance_key is not None else self._active_instances ) - ping_rpc = channel.unary_unary( + ping_rpc = self.transport._grpc_channel.unary_unary( "/google.bigtable.v2.Bigtable/PingAndWarm", request_serializer=PingAndWarmRequest.serialize, ) @@ -289,7 +288,7 @@ async def _manage_channel( next_sleep = max(first_refresh - time.monotonic(), 0) if next_sleep > 0: # warm the current channel immediately - await self._ping_and_warm_instances(self.transport._grpc_channel) + await self._ping_and_warm_instances() # continuously refresh the channel every `refresh_interval` seconds while True: await asyncio.sleep(next_sleep) @@ -297,7 +296,7 @@ async def _manage_channel( # prepare new channel for use old_channel = self.transport._grpc_channel new_channel = self.transport_create_channel() - await self._ping_and_warm_instances(new_channel) + await self._ping_and_warm_instances() # cycle channel out of use, with long grace window before closure self.transport._grpc_channel = new_channel await old_channel.close(grace_period)