From 2e611445f669268a9b3799f779946c48aa808416 Mon Sep 17 00:00:00 2001 From: George Panchuk Date: Sat, 3 Feb 2024 14:02:21 +0100 Subject: [PATCH] fix: add grpc_grace param to close in QdrantClient --- qdrant_client/async_qdrant_client.py | 10 ++++++---- qdrant_client/qdrant_client.py | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/qdrant_client/async_qdrant_client.py b/qdrant_client/async_qdrant_client.py index 6bc9dfd8..05500779 100644 --- a/qdrant_client/async_qdrant_client.py +++ b/qdrant_client/async_qdrant_client.py @@ -128,12 +128,14 @@ def __init__( except ImportError: self._is_fastembed_installed = False - async def close(self, **kwargs: Any) -> None: - """ - Closes the connection to Qdrant + async def close(self, grpc_grace: Optional[float] = None, **kwargs: Any) -> None: + """Closes the connection to Qdrant + + Args: + grpc_grace: Grace period for gRPC connection close. Default: None """ if hasattr(self, "_client"): - await self._client.close(**kwargs) + await self._client.close(grpc_grace=grpc_grace, **kwargs) @property def grpc_collections(self) -> grpc.CollectionsStub: diff --git a/qdrant_client/qdrant_client.py b/qdrant_client/qdrant_client.py index 33ac2cef..bce0ca20 100644 --- a/qdrant_client/qdrant_client.py +++ b/qdrant_client/qdrant_client.py @@ -131,12 +131,14 @@ def __init__( def __del__(self) -> None: self.close() - def close(self, **kwargs: Any) -> None: - """ - Closes the connection to Qdrant + def close(self, grpc_grace: Optional[float] = None, **kwargs: Any) -> None: + """Closes the connection to Qdrant + + Args: + grpc_grace: Grace period for gRPC connection close. Default: None """ if hasattr(self, "_client"): - self._client.close(**kwargs) + self._client.close(grpc_grace=grpc_grace, **kwargs) @property def grpc_collections(self) -> grpc.CollectionsStub: