Skip to content

Commit 988ee60

Browse files
committed
Resume reading only in read
1 parent 506527f commit 988ee60

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pymongo/network_layer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,23 +512,23 @@ async def write(self, message: bytes) -> None:
512512
if self.transport.is_closing():
513513
raise OSError("Connection is closed")
514514
self.transport.write(message)
515-
self.transport.resume_reading()
515+
# self.transport.resume_reading()
516516

517517
async def read(self, request_id: Optional[int], max_message_size: int) -> tuple[bytes, int]:
518518
"""Read a single MongoDB Wire Protocol message from this connection."""
519+
self._request_id = request_id
519520
if self.transport:
520521
try:
521522
self.transport.resume_reading()
522523
# Known bug in SSL Protocols, fixed in Python 3.11: https://github.com/python/cpython/issues/89322
523524
except AttributeError:
524525
raise OSError("connection is already closed") from None
525526
self._max_message_size = max_message_size
526-
self._request_id = request_id
527527
if self._done_messages:
528528
message = await self._done_messages.popleft()
529529
else:
530-
# if self.transport and self.transport.is_closing():
531-
# raise OSError("connection is already closed")
530+
if self.transport and self.transport.is_closing():
531+
raise OSError("connection is already closed")
532532
read_waiter = asyncio.get_running_loop().create_future()
533533
self._pending_messages.append(read_waiter)
534534
try:

0 commit comments

Comments
 (0)