1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-26 21:47:15 +00:00

File open calls to executor (#5678)

This commit is contained in:
Mike Degatano
2025-02-28 03:56:59 -05:00
committed by GitHub
parent dfed251c7a
commit 2274de969f
10 changed files with 136 additions and 76 deletions

View File

@@ -217,12 +217,15 @@ class OSManager(CoreSysAttributes):
)
# Download RAUCB file
with raucb.open("wb") as ota_file:
ota_file = await self.sys_run_in_executor(raucb.open, "wb")
try:
while True:
chunk = await request.content.read(1_048_576)
if not chunk:
break
ota_file.write(chunk)
await self.sys_run_in_executor(ota_file.write, chunk)
finally:
await self.sys_run_in_executor(ota_file.close)
_LOGGER.info("Completed download of OTA update file %s", raucb)