Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add grpc_grace param to close in QdrantClient #477

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading