Skip to content

Commit 92df487

Browse files
XuanYang-cntedxudependabot[bot]
authored
enhance: Cherry pick multiple prs (#2882)
1. enhance: reuse channel by default (#2873) 2. Bug fixes in async client (#2863) 3.build(deps): bump urllib3 from 1.26.19 to 2.5.0 (#2864) --------- Signed-off-by: yangxuan <[email protected]> Co-authored-by: Ted Xu <[email protected]> Co-authored-by: dependabot[bot] <[email protected]>
1 parent e60ef0f commit 92df487

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ coverage.xml
3535

3636
# Example data
3737
/examples/bulk_writer
38+
39+
# uv
40+
uv.lock

pymilvus/milvus_client/async_milvus_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22
from typing import Dict, List, Optional, Union
3-
from uuid import uuid4
43

54
from pymilvus.client.abstract import AnnSearchRequest, BaseRanker
65
from pymilvus.client.constants import DEFAULT_CONSISTENCY_LEVEL
@@ -586,8 +585,9 @@ def _create_connection(
586585
**kwargs,
587586
) -> str:
588587
"""Create the connection to the Milvus server."""
589-
# TODO: Implement reuse with new uri style
590-
using = uuid4().hex
588+
using = kwargs.pop("alias", None)
589+
if not using:
590+
using = f"async-{uri}{user}"
591591
try:
592592
connections.connect(
593593
using, user, password, db_name, token, uri=uri, _async=True, **kwargs

pymilvus/milvus_client/milvus_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22
from typing import Dict, List, Optional, Union
3-
from uuid import uuid4
43

54
from pymilvus.client.abstract import AnnSearchRequest, BaseRanker
65
from pymilvus.client.constants import DEFAULT_CONSISTENCY_LEVEL
@@ -908,8 +907,9 @@ def _create_connection(
908907
**kwargs,
909908
) -> str:
910909
"""Create the connection to the Milvus server."""
911-
# TODO: Implement reuse with new uri style
912-
using = kwargs.pop("alias", None) or uuid4().hex
910+
using = kwargs.pop("alias", None)
911+
if not using:
912+
using = f"{uri}{user}"
913913
try:
914914
connections.connect(using, user, password, db_name, token, uri=uri, **kwargs)
915915
except Exception as ex:

pymilvus/orm/connections.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ def connect(
321321
"""
322322
Constructs a milvus connection and register it under given alias.
323323
324-
:param alias: The name of milvus connection
324+
:param alias: The name of milvus connection. For each alias, there will be one and only one
325+
connection created.
325326
:type alias: str
326327
327328
:param kwargs:

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pyparsing==2.4.7
1313
six==1.16.0
1414
toml==0.10.2
1515
ujson>=2.0.0
16-
urllib3==1.26.19
16+
urllib3==2.5.0
1717
m2r==0.3.1
1818
Sphinx==4.0.0
1919
sphinx-copybutton

0 commit comments

Comments
 (0)