My code downloads huge file with httpx and process it's chunks on the fly
async with httpx.AsyncClient() as client:
async with client.stream("GET", self.url, follow_redirects=True, timeout=60) as stream:
async for chunk in stream.aiter_text():
parser.feed(chunk)
await self._process_element(parser)
When I run it on my notebook it works good but in the the kuber cluster on dedicated pod I have got error: httpx.RemoteProtocolError: peer closed connection without sending complete message body
after about 300K _process_element()
's.
Doc for h11 says, that "maximum number of bytes we’re willing to buffer of an incomplete event. In practice this mostly sets a limit on the maximum size of the request/response line + headers. If this is exceeded, then next_event()
will raise RemoteProtocolError
." Does it means my code working too slow and cannot manage incoming stream? And the 2nd: can I increase buffer for incoming stream? There is no interface for this in HTTPX as far as I know.
Any advises welcome. Thank you.