mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Fix filesize doing IO in event loop (#72038)
This commit is contained in:
parent
d34d3baa07
commit
6b0c7a2dd4
@ -132,7 +132,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