Skip to content

Commit d1cc4f9

Browse files
committed
PYTHON 5212 - Use asyncio.loop.sock_connect in _async_create_connection
1 parent f645036 commit d1cc4f9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pymongo/pool_shared.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ async def _async_create_connection(address: _Address, options: PoolOptions) -> s
244244
sock.settimeout(timeout)
245245
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, True)
246246
_set_keepalive_times(sock)
247-
sock.connect(sa)
247+
sock.setblocking(False)
248+
await asyncio.get_running_loop().sock_connect(sock, sa)
248249
return sock
249250
except OSError as e:
250251
err = e

0 commit comments

Comments
 (0)