Skip to content

Commit 2f841a2

Browse files
committed
PYTHON-4324 Fix typing and receive_data call
1 parent c756d9c commit 2f841a2

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pymongo/asynchronous/pool.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ async def complete_pending(self) -> None:
206206
timeout = self.conn.gettimeout
207207
if _csot.get_timeout():
208208
deadline = min(_csot.get_deadline(), self.pending_deadline)
209-
elif timeout:
209+
elif timeout is not None:
210210
deadline = min(time.monotonic() + timeout, self.pending_deadline)
211211
else:
212212
deadline = self.pending_deadline
@@ -216,8 +216,7 @@ async def complete_pending(self) -> None:
216216
# TODO: respect deadline
217217
await self.receive_message(None, True)
218218
else:
219-
# In sync we need to track the bytes left for the message.
220-
network_layer.receive_data(self.conn, self.pending_bytes, deadline)
219+
network_layer.receive_data(self, self.pending_bytes, deadline) # type:ignore[call-arg]
221220
self.pending_response = False
222221
self.pending_bytes = 0
223222
self.pending_deadline = 0.0

pymongo/synchronous/pool.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def complete_pending(self) -> None:
206206
timeout = self.conn.gettimeout
207207
if _csot.get_timeout():
208208
deadline = min(_csot.get_deadline(), self.pending_deadline)
209-
elif timeout:
209+
elif timeout is not None:
210210
deadline = min(time.monotonic() + timeout, self.pending_deadline)
211211
else:
212212
deadline = self.pending_deadline
@@ -216,8 +216,7 @@ def complete_pending(self) -> None:
216216
# TODO: respect deadline
217217
self.receive_message(None, True)
218218
else:
219-
# In sync we need to track the bytes left for the message.
220-
network_layer.receive_data(self.conn, self.pending_bytes, deadline)
219+
network_layer.receive_data(self, self.pending_bytes, deadline) # type:ignore[call-arg]
221220
self.pending_response = False
222221
self.pending_bytes = 0
223222
self.pending_deadline = 0.0

0 commit comments

Comments
 (0)