Skip to content

Commit

Permalink
Fix blocking event loop call in matrix (home-assistant#122730)
Browse files Browse the repository at this point in the history
Wrap load_json_object in async_add_executor_job
  • Loading branch information
PaarthShah authored Jul 31, 2024
1 parent e0a1aaa commit 015a1a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion homeassistant/components/matrix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ async def _join_rooms(self) -> None:
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",
Expand Down

0 comments on commit 015a1a6

Please sign in to comment.