We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fa651c commit e059fdeCopy full SHA for e059fde
pymongo/mongo_client.py
@@ -862,6 +862,7 @@ def __init__(
862
server_monitoring_mode=options.server_monitoring_mode,
863
)
864
865
+ self._opened = False
866
self._init_background()
867
868
if connect:
@@ -1245,9 +1246,11 @@ def _get_topology(self) -> Topology:
1245
1246
If this client was created with "connect=False", calling _get_topology
1247
launches the connection process in the background.
1248
"""
- self._topology.open()
1249
- with self.__lock:
1250
- self._kill_cursors_executor.open()
+ if not self._opened:
+ self._topology.open()
1251
+ with self.__lock:
1252
+ self._kill_cursors_executor.open()
1253
+ self._opened = True
1254
return self._topology
1255
1256
@contextlib.contextmanager
0 commit comments