Fix blocking event loop call in matrix (#122730)

Wrap load_json_object in async_add_executor_job
pull/122993/head
Paarth Shah 2024-07-31 00:45:30 -07:00 committed by GitHub
parent e0a1aaa1b9
commit 015a1a6ebc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -349,7 +349,9 @@ class MatrixBot:
async def _get_auth_tokens(self) -> JsonObjectType:
"""Read sorted authentication tokens from disk."""
try:
return load_json_object(self._session_filepath)
return await self.hass.async_add_executor_job(
load_json_object, self._session_filepath
)
except HomeAssistantError as ex:
_LOGGER.warning(
"Loading authentication tokens from file '%s' failed: %s",