File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -854,6 +854,7 @@ def __init__(
854
854
server_monitoring_mode = options .server_monitoring_mode ,
855
855
)
856
856
857
+ self ._opened = False
857
858
self ._init_background ()
858
859
859
860
if _IS_SYNC and connect :
@@ -1528,9 +1529,11 @@ async def _get_topology(self) -> Topology:
1528
1529
If this client was created with "connect=False", calling _get_topology
1529
1530
launches the connection process in the background.
1530
1531
"""
1531
- await self ._topology .open ()
1532
- async with self ._lock :
1533
- self ._kill_cursors_executor .open ()
1532
+ if not self ._opened :
1533
+ await self ._topology .open ()
1534
+ async with self ._lock :
1535
+ self ._kill_cursors_executor .open ()
1536
+ self ._opened = True
1534
1537
return self ._topology
1535
1538
1536
1539
@contextlib .asynccontextmanager
Original file line number Diff line number Diff line change @@ -853,6 +853,7 @@ def __init__(
853
853
server_monitoring_mode = options .server_monitoring_mode ,
854
854
)
855
855
856
+ self ._opened = False
856
857
self ._init_background ()
857
858
858
859
if _IS_SYNC and connect :
@@ -1527,9 +1528,11 @@ def _get_topology(self) -> Topology:
1527
1528
If this client was created with "connect=False", calling _get_topology
1528
1529
launches the connection process in the background.
1529
1530
"""
1530
- self ._topology .open ()
1531
- with self ._lock :
1532
- self ._kill_cursors_executor .open ()
1531
+ if not self ._opened :
1532
+ self ._topology .open ()
1533
+ with self ._lock :
1534
+ self ._kill_cursors_executor .open ()
1535
+ self ._opened = True
1533
1536
return self ._topology
1534
1537
1535
1538
@contextlib .contextmanager
You can’t perform that action at this time.
0 commit comments