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 connect timeout bug #1802

Merged
merged 1 commit into from
Nov 29, 2023
Merged
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
8 changes: 4 additions & 4 deletions pymilvus/client/grpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _wait_for_channel_ready(self, timeout: Union[float] = 10):

try:
grpc.channel_ready_future(self._channel).result(timeout=timeout)
self._setup_identifier_interceptor(self._user)
self._setup_identifier_interceptor(self._user, timeout=timeout)
except grpc.FutureTimeoutError as e:
raise MilvusException(
code=Status.CONNECT_FAILED,
Expand Down Expand Up @@ -244,9 +244,9 @@ def set_onetime_request_id(self, req_id: int):
self._request_id = req_id
self._setup_grpc_channel()

def _setup_identifier_interceptor(self, user: str):
def _setup_identifier_interceptor(self, user: str, timeout: int = 10):
host = socket.gethostname()
self._identifier = self.__internal_register(user, host)
self._identifier = self.__internal_register(user, host, timeout=timeout)
self._identifier_interceptor = interceptor.header_adder_interceptor(
["identifier"], [str(self._identifier)]
)
Expand Down Expand Up @@ -1884,7 +1884,7 @@ def _check():

@retry_on_rpc_failure()
@upgrade_reminder
def __internal_register(self, user: str, host: str) -> int:
def __internal_register(self, user: str, host: str, **kwargs) -> int:
req = Prepare.register_request(user, host)
response = self._stub.Connect(request=req)
if response.status.code != ErrorCode.SUCCESS:
Expand Down
Loading