From 94ca12d811e3d72e9a355743c1d7d9ff444b1159 Mon Sep 17 00:00:00 2001 From: Oleg Ovcharuk Date: Thu, 5 Sep 2024 19:51:13 +0300 Subject: [PATCH] Remove connection from pool before waiting for results --- ydb/aio/connection.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ydb/aio/connection.py b/ydb/aio/connection.py index 9c661490..1f328a37 100644 --- a/ydb/aio/connection.py +++ b/ydb/aio/connection.py @@ -227,7 +227,7 @@ async def connection_ready(self, ready_timeout=10): await asyncio.wait_for(self._channel.channel_ready(), timeout=ready_timeout) - async def close(self, grace: float = None): + async def close(self, grace: float = 30): """ Closes the underlying gRPC channel :param: grace: If a grace period is specified, this method wait until all active @@ -239,12 +239,12 @@ async def close(self, grace: float = None): self.closing = True - if self.calls: - await asyncio.wait(self.calls.values(), timeout=grace) - for callback in self._cleanup_callbacks: callback(self) + if self.calls: + await asyncio.wait(self.calls.values(), timeout=grace) + await self.destroy() async def __aenter__(self):