Skip to content

Commit 59e1897

Browse files
committed
Try detecting faas
1 parent 7a15f04 commit 59e1897

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pymongo/network_layer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from pymongo.compression_support import decompress
3737
from pymongo.errors import ProtocolError, _OperationCancelled
3838
from pymongo.message import _UNPACK_REPLY, _OpMsg, _OpReply
39+
from pymongo.pool_options import _is_faas
3940
from pymongo.socket_checker import _errno_from_exception
4041

4142
try:
@@ -357,7 +358,12 @@ def receive_data(conn: Connection, length: int, deadline: Optional[float]) -> me
357358
except socket.timeout:
358359
if conn.cancel_context.cancelled:
359360
raise _OperationCancelled("operation cancelled") from None
360-
if _PYPY or deadline is not None and deadline - time.monotonic() < 0:
361+
if (
362+
_PYPY
363+
or not _is_faas()
364+
and deadline is not None
365+
and deadline - time.monotonic() < 0
366+
):
361367
# We reached the true deadline.
362368
raise
363369
continue

0 commit comments

Comments
 (0)