Skip to content

Commit

Permalink
grpc thread is not released each time connections.connect() is failed (
Browse files Browse the repository at this point in the history
…#2649)

#2646

Signed-off-by: yhmo <[email protected]>
  • Loading branch information
yhmo authored Feb 17, 2025
1 parent 43779e8 commit 3d7c948
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pymilvus/client/grpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,19 @@ def _wait_for_channel_ready(self, timeout: Union[float] = 10):
grpc.channel_ready_future(self._channel).result(timeout=timeout)
self._setup_identifier_interceptor(self._user, timeout=timeout)
except grpc.FutureTimeoutError as e:
self.close()
raise MilvusException(
code=Status.CONNECT_FAILED,
message=f"Fail connecting to server on {self._address}, illegal connection params or server unavailable",
) from e
except Exception as e:
self.close()
raise e from e

def close(self):
self.deregister_state_change_callbacks()
self._channel.close()
self._channel = None

def reset_db_name(self, db_name: str):
self.schema_cache.clear()
Expand Down

0 comments on commit 3d7c948

Please sign in to comment.