Skip to content

Commit 39e9ea5

Browse files
committed
Restore TOTALS
1 parent 79705b9 commit 39e9ea5

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

pymongo/asynchronous/network.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@
6363

6464
_IS_SYNC = False
6565

66-
TOTAL = []
67-
TOTAL_WRITE = []
68-
TOTAL_READ = []
69-
print(f"TOTALS: {TOTAL, TOTAL_WRITE, TOTAL_READ}")
66+
# TOTAL = []
67+
# TOTAL_WRITE = []
68+
# TOTAL_READ = []
69+
# print(f"TOTALS: {TOTAL, TOTAL_WRITE, TOTAL_READ}")
7070

7171

7272
async def command_stream(
@@ -211,13 +211,13 @@ async def command_stream(
211211
read_start = time.monotonic()
212212
reply = await receive_message_stream(conn, request_id)
213213
read_elapsed = time.monotonic() - read_start
214-
if name == "insert":
215-
TOTAL.append(write_elapsed + read_elapsed)
216-
TOTAL_READ.append(read_elapsed)
217-
TOTAL_WRITE.append(write_elapsed)
218-
if name == "endSessions":
219-
print(
220-
f"AVERAGE READ: {statistics.mean(TOTAL_READ)}, AVERAGE WRITE: {statistics.mean(TOTAL_WRITE)}, AVERAGE ELAPSED: {statistics.mean(TOTAL)}")
214+
# if name == "insert":
215+
# TOTAL.append(write_elapsed + read_elapsed)
216+
# TOTAL_READ.append(read_elapsed)
217+
# TOTAL_WRITE.append(write_elapsed)
218+
# if name == "endSessions":
219+
# print(
220+
# f"AVERAGE READ: {statistics.mean(TOTAL_READ)}, AVERAGE WRITE: {statistics.mean(TOTAL_WRITE)}, AVERAGE ELAPSED: {statistics.mean(TOTAL)}")
221221
conn.more_to_come = reply.more_to_come
222222
unpacked_docs = reply.unpack_response(
223223
codec_options=codec_options, user_fields=user_fields

pymongo/network_layer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from pymongo._asyncio_task import create_task
3535
from pymongo.common import MAX_MESSAGE_SIZE
3636
from pymongo.errors import _OperationCancelled
37+
from pymongo.message import _OpReply, _UNPACK_REPLY
3738
from pymongo.socket_checker import _errno_from_exception
3839

3940
try:
@@ -75,7 +76,7 @@
7576
class PyMongoProtocol(asyncio.BufferedProtocol):
7677
def __init__(self):
7778
self.transport = None
78-
self._buffer = memoryview(bytearray(MAX_MESSAGE_SIZE))
79+
self._buffer = memoryview(bytearray(65536)) # 64KB default buffer for SSL handshakes
7980
self.expected_length = 0
8081
self.expecting_header = False
8182
self.bytes_read = 0

0 commit comments

Comments
 (0)