Skip to content

Commit 0b6d303

Browse files
committed
address comment ish - remove first
1 parent b60eb60 commit 0b6d303

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pymongo/asynchronous/mongo_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ def __init__(
869869
self._opened = False
870870
self._closed = False
871871
if not is_srv:
872-
self._init_background(first=True)
872+
self._init_background()
873873

874874
if _IS_SYNC and connect:
875875
self._get_topology() # type: ignore[unused-coroutine]
@@ -1000,9 +1000,9 @@ async def aconnect(self) -> None:
10001000
"""Explicitly connect to MongoDB asynchronously instead of on the first operation."""
10011001
await self._get_topology()
10021002

1003-
def _init_background(self, old_pid: Optional[int] = None, first: bool = False) -> None:
1003+
def _init_background(self, old_pid: Optional[int] = None) -> None:
10041004
self._topology = Topology(self._topology_settings)
1005-
if first and _HAS_REGISTER_AT_FORK:
1005+
if _HAS_REGISTER_AT_FORK:
10061006
# Add this client to the list of weakly referenced items.
10071007
# This will be used later if we fork.
10081008
AsyncMongoClient._clients[self._topology._topology_id] = self
@@ -1707,7 +1707,7 @@ async def _get_topology(self) -> Topology:
17071707
if not self._opened:
17081708
if self._resolve_srv_info["is_srv"]:
17091709
await self._resolve_srv()
1710-
self._init_background(first=True)
1710+
self._init_background()
17111711
await self._topology.open()
17121712
async with self._lock:
17131713
self._kill_cursors_executor.open()

pymongo/synchronous/mongo_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ def __init__(
867867
self._opened = False
868868
self._closed = False
869869
if not is_srv:
870-
self._init_background(first=True)
870+
self._init_background()
871871

872872
if _IS_SYNC and connect:
873873
self._get_topology() # type: ignore[unused-coroutine]
@@ -998,9 +998,9 @@ def _connect(self) -> None:
998998
"""Explicitly connect to MongoDB synchronously instead of on the first operation."""
999999
self._get_topology()
10001000

1001-
def _init_background(self, old_pid: Optional[int] = None, first: bool = False) -> None:
1001+
def _init_background(self, old_pid: Optional[int] = None) -> None:
10021002
self._topology = Topology(self._topology_settings)
1003-
if first and _HAS_REGISTER_AT_FORK:
1003+
if _HAS_REGISTER_AT_FORK:
10041004
# Add this client to the list of weakly referenced items.
10051005
# This will be used later if we fork.
10061006
MongoClient._clients[self._topology._topology_id] = self
@@ -1701,7 +1701,7 @@ def _get_topology(self) -> Topology:
17011701
if not self._opened:
17021702
if self._resolve_srv_info["is_srv"]:
17031703
self._resolve_srv()
1704-
self._init_background(first=True)
1704+
self._init_background()
17051705
self._topology.open()
17061706
with self._lock:
17071707
self._kill_cursors_executor.open()

0 commit comments

Comments
 (0)