mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Switch hassio to use iter_chunks (#102031)
This commit is contained in:
parent
471d1abe47
commit
683046272d
@ -178,7 +178,10 @@ class HassIOView(HomeAssistantView):
|
|||||||
if should_compress(response.content_type):
|
if should_compress(response.content_type):
|
||||||
response.enable_compression()
|
response.enable_compression()
|
||||||
await response.prepare(request)
|
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)
|
await response.write(data)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
@ -198,7 +198,10 @@ class HassIOIngress(HomeAssistantView):
|
|||||||
if should_compress(response.content_type):
|
if should_compress(response.content_type):
|
||||||
response.enable_compression()
|
response.enable_compression()
|
||||||
await response.prepare(request)
|
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)
|
await response.write(data)
|
||||||
|
|
||||||
except (
|
except (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user