Skip to content

Commit c58448f

Browse files
committed
realizing condition needs to be reverted too
1 parent c92f6af commit c58448f

File tree

2 files changed

+20
-36
lines changed

2 files changed

+20
-36
lines changed

pymongo/asynchronous/topology.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
from __future__ import annotations
1818

19-
import asyncio
2019
import logging
2120
import os
2221
import queue
@@ -355,15 +354,7 @@ async def _select_servers_loop(
355354
# change, or for a timeout. We won't miss any changes that
356355
# came after our most recent apply_selector call, since we've
357356
# held the lock until now.
358-
if _IS_SYNC:
359-
await self._condition.wait(common.MIN_HEARTBEAT_INTERVAL)
360-
else:
361-
try:
362-
await asyncio.wait_for(
363-
self._condition.wait(), common.MIN_HEARTBEAT_INTERVAL
364-
) # type-ignore: [arg-type]
365-
except asyncio.TimeoutError:
366-
pass
357+
await self._condition.wait(common.MIN_HEARTBEAT_INTERVAL)
367358
self._description.check_compatible()
368359
now = time.monotonic()
369360
server_descriptions = self._description.apply_selector(
@@ -663,15 +654,15 @@ async def request_check_all(self, wait_time: int = 5) -> None:
663654
"""Wake all monitors, wait for at least one to check its server."""
664655
async with self._lock:
665656
self._request_check_all()
666-
if _IS_SYNC:
667-
await self._condition.wait(wait_time)
668-
else:
669-
try:
670-
await asyncio.wait_for(
671-
self._condition.wait(), wait_time
672-
) # type-ignore: [arg-type]
673-
except asyncio.TimeoutError:
674-
pass
657+
# if _IS_SYNC:
658+
await self._condition.wait(wait_time)
659+
# else:
660+
# try:
661+
# await asyncio.wait_for(
662+
# self._condition.wait(), wait_time
663+
# ) # type-ignore: [arg-type]
664+
# except asyncio.TimeoutError:
665+
# pass
675666

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

pymongo/synchronous/topology.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
from __future__ import annotations
1818

19-
import asyncio
2019
import logging
2120
import os
2221
import queue
@@ -355,15 +354,7 @@ def _select_servers_loop(
355354
# change, or for a timeout. We won't miss any changes that
356355
# came after our most recent apply_selector call, since we've
357356
# held the lock until now.
358-
if _IS_SYNC:
359-
self._condition.wait(common.MIN_HEARTBEAT_INTERVAL)
360-
else:
361-
try:
362-
asyncio.wait_for(
363-
self._condition.wait(), common.MIN_HEARTBEAT_INTERVAL
364-
) # type-ignore: [arg-type]
365-
except asyncio.TimeoutError:
366-
pass
357+
self._condition.wait(common.MIN_HEARTBEAT_INTERVAL)
367358
self._description.check_compatible()
368359
now = time.monotonic()
369360
server_descriptions = self._description.apply_selector(
@@ -661,13 +652,15 @@ def request_check_all(self, wait_time: int = 5) -> None:
661652
"""Wake all monitors, wait for at least one to check its server."""
662653
with self._lock:
663654
self._request_check_all()
664-
if _IS_SYNC:
665-
self._condition.wait(wait_time)
666-
else:
667-
try:
668-
asyncio.wait_for(self._condition.wait(), wait_time) # type-ignore: [arg-type]
669-
except asyncio.TimeoutError:
670-
pass
655+
# if _IS_SYNC:
656+
self._condition.wait(wait_time)
657+
# else:
658+
# try:
659+
# asyncio.wait_for(
660+
# self._condition.wait(), wait_time
661+
# ) # type-ignore: [arg-type]
662+
# except asyncio.TimeoutError:
663+
# pass
671664

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

0 commit comments

Comments
 (0)