Skip to content

Commit 1b3f04c

Browse files
authored
PYTHON-5020 Fix behavior of network timeouts on pyopenssl connections (mongodb#2037)
1 parent d2d8f6e commit 1b3f04c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pymongo/pyopenssl_context.py

Lines changed: 2 additions & 1 deletion
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)