Skip to content

Commit 7c9cdf1

Browse files
committed
PYTHON-5020 Fix behavior of network timeouts on pyopenssl connections
1 parent b3ce932 commit 7c9cdf1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pymongo/pyopenssl_context.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ def _call(self, call: Callable[..., _T], *args: Any, **kwargs: Any) -> _T:
125125
try:
126126
return call(*args, **kwargs)
127127
except BLOCKING_IO_ERRORS as exc:
128-
if is_async:
128+
# Do not retry if the connection is in non-blocking mode.
129+
if is_async or timeout == 0:
129130
raise exc
130131
# Check for closed socket.
131132
if self.fileno() == -1:

0 commit comments

Comments
 (0)