Skip to content

Commit

Permalink
fix: add grpc_grace param to close in QdrantClient
Browse files Browse the repository at this point in the history
  • Loading branch information
joein committed Feb 3, 2024
1 parent 5e564e6 commit 2e61144
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions qdrant_client/async_qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions qdrant_client/qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2e61144

Please sign in to comment.