Skip to content

Commit 0aa9075

Browse files
committed
fix task/thread name and delete commented out code
1 parent 9631ed6 commit 0aa9075

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

pymongo/asynchronous/monitor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,13 @@ def __init__(
136136
The Topology is weakly referenced. The Pool must be exclusive to this
137137
Monitor.
138138
"""
139+
if _IS_SYNC:
140+
name = "pymongo_server_monitor_thread"
141+
else:
142+
name = "pymongo_server_monitor_task"
139143
super().__init__(
140144
topology,
141-
"pymongo_server_monitor_task",
145+
name,
142146
topology_settings.heartbeat_frequency,
143147
common.MIN_HEARTBEAT_INTERVAL,
144148
)

pymongo/asynchronous/topology.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -653,15 +653,7 @@ async def request_check_all(self, wait_time: int = 5) -> None:
653653
"""Wake all monitors, wait for at least one to check its server."""
654654
async with self._lock:
655655
self._request_check_all()
656-
# if _IS_SYNC:
657656
await self._condition.wait(wait_time)
658-
# else:
659-
# try:
660-
# await asyncio.wait_for(
661-
# self._condition.wait(), wait_time
662-
# ) # type-ignore: [arg-type]
663-
# except asyncio.TimeoutError:
664-
# pass
665657

666658
def data_bearing_servers(self) -> list[ServerDescription]:
667659
"""Return a list of all data-bearing servers.

pymongo/synchronous/monitor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,13 @@ def __init__(
136136
The Topology is weakly referenced. The Pool must be exclusive to this
137137
Monitor.
138138
"""
139+
if _IS_SYNC:
140+
name = "pymongo_server_monitor_task"
141+
else:
142+
name = "pymongo_server_monitor_task"
139143
super().__init__(
140144
topology,
141-
"pymongo_server_monitor_task",
145+
name,
142146
topology_settings.heartbeat_frequency,
143147
common.MIN_HEARTBEAT_INTERVAL,
144148
)

pymongo/synchronous/topology.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -651,15 +651,7 @@ def request_check_all(self, wait_time: int = 5) -> None:
651651
"""Wake all monitors, wait for at least one to check its server."""
652652
with self._lock:
653653
self._request_check_all()
654-
# if _IS_SYNC:
655654
self._condition.wait(wait_time)
656-
# else:
657-
# try:
658-
# asyncio.wait_for(
659-
# self._condition.wait(), wait_time
660-
# ) # type-ignore: [arg-type]
661-
# except asyncio.TimeoutError:
662-
# pass
663655

664656
def data_bearing_servers(self) -> list[ServerDescription]:
665657
"""Return a list of all data-bearing servers.

0 commit comments

Comments
 (0)