mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Fix filesize doing IO in event loop (#72038)
This commit is contained in:
parent
c4fc84ec1e
commit
c52f535eb3
@ -96,7 +96,7 @@ class FileSizeCoordinator(DataUpdateCoordinator):
|
|||||||
async def _async_update_data(self) -> dict[str, float | int | datetime]:
|
async def _async_update_data(self) -> dict[str, float | int | datetime]:
|
||||||
"""Fetch file information."""
|
"""Fetch file information."""
|
||||||
try:
|
try:
|
||||||
statinfo = os.stat(self._path)
|
statinfo = await self.hass.async_add_executor_job(os.stat, self._path)
|
||||||
except OSError as error:
|
except OSError as error:
|
||||||
raise UpdateFailed(f"Can not retrieve file statistics {error}") from error
|
raise UpdateFailed(f"Can not retrieve file statistics {error}") from error
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user