Skip to content

Commit 7a15f04

Browse files
committed
PYTHON-5369 - Re-raise socket.timeout errors if the deadline has already been execeeded
1 parent 0ec5778 commit 7a15f04

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pymongo/network_layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def receive_data(conn: Connection, length: int, deadline: Optional[float]) -> me
357357
except socket.timeout:
358358
if conn.cancel_context.cancelled:
359359
raise _OperationCancelled("operation cancelled") from None
360-
if _PYPY:
360+
if _PYPY or deadline is not None and deadline - time.monotonic() < 0:
361361
# We reached the true deadline.
362362
raise
363363
continue

0 commit comments

Comments
 (0)