Skip to content

Commit

Permalink
Merge pull request #19 from atugushev/increase-chunk-size
Browse files Browse the repository at this point in the history
Increase chunk size for IO stream reader
  • Loading branch information
GinTR1k authored Jul 23, 2020
2 parents 4b9716e + 859b92a commit b4312f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ansq/tcp/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from time import time
from typing import Optional, Callable, Any, Union, Generator

from ansq.tcp import consts
from ansq.tcp.exceptions import ProtocolError, get_exception, NSQUnauthorized
from ansq.tcp.types import (
TCPConnection as NSQConnectionBase, ConnectionStatus, NSQMessage,
Expand Down Expand Up @@ -218,7 +219,7 @@ async def _read_data_task(self):
"""Response reader task."""
while not self._reader.at_eof():
try:
data = await self._reader.read(52)
data = await self._reader.read(consts.MAX_CHUNK_SIZE)
except asyncio.CancelledError:
# useful during update to TLS, task canceled but connection
# should not be closed
Expand Down
1 change: 1 addition & 0 deletions ansq/tcp/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
ATTEMPTS_SIZE = 2
MSG_ID_SIZE = 16
MSG_HEADER = TIMESTAMP_SIZE + ATTEMPTS_SIZE + MSG_ID_SIZE
MAX_CHUNK_SIZE = 4096

0 comments on commit b4312f9

Please sign in to comment.