Skip to content

Commit

Permalink
Fix connect timeout bug (#1802)
Browse files Browse the repository at this point in the history
Signed-off-by: junjie.jiang <[email protected]>
  • Loading branch information
junjiejiangjjj authored Nov 29, 2023
1 parent 49fdc74 commit 85e6d50
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 85e6d50

Please sign in to comment.