diff --git a/homeassistant/components/hassio/http.py b/homeassistant/components/hassio/http.py index 0d23a953128..cabe6f085ba 100644 --- a/homeassistant/components/hassio/http.py +++ b/homeassistant/components/hassio/http.py @@ -178,7 +178,10 @@ class HassIOView(HomeAssistantView): if should_compress(response.content_type): response.enable_compression() await response.prepare(request) - async for data in client.content.iter_chunked(8192): + # In testing iter_chunked, iter_any, and iter_chunks: + # iter_chunks was the best performing option since + # it does not have to do as much re-assembly + async for data, _ in client.content.iter_chunks(): await response.write(data) return response diff --git a/homeassistant/components/hassio/ingress.py b/homeassistant/components/hassio/ingress.py index 4a612de7f87..dc4f3234b60 100644 --- a/homeassistant/components/hassio/ingress.py +++ b/homeassistant/components/hassio/ingress.py @@ -198,7 +198,10 @@ class HassIOIngress(HomeAssistantView): if should_compress(response.content_type): response.enable_compression() await response.prepare(request) - async for data in result.content.iter_chunked(8192): + # In testing iter_chunked, iter_any, and iter_chunks: + # iter_chunks was the best performing option since + # it does not have to do as much re-assembly + async for data, _ in result.content.iter_chunks(): await response.write(data) except (