Skip to content

Commit 9d34e52

Browse files
committed
improve sleep translation
1 parent f1544aa commit 9d34e52

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pymongo/synchronous/pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ def connect(self, handler: Optional[_MongoClientErrorHandler] = None) -> Connect
10541054

10551055
# Apply backoff if applicable.
10561056
if self._backoff:
1057-
asyncio.sleep(_backoff(self._backoff))
1057+
time.sleep(_backoff(self._backoff))
10581058

10591059
try:
10601060
networking_interface = _configured_socket_interface(self.address, self.opts)

tools/synchro.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def translate_async_sleeps(lines: list[str]) -> list[str]:
341341
sleeps = [line for line in lines if "asyncio.sleep" in line]
342342

343343
for line in sleeps:
344-
res = re.search(r"asyncio.sleep\(([^()]*)\)", line)
344+
res = re.search(r"asyncio\.sleep\s*\(\s*(.*?)\s*\)", line)
345345
if res:
346346
old = res[0]
347347
index = lines.index(line)

0 commit comments

Comments
 (0)