Use recorder threadpool in WS recorder/get_statistics_metadata (#68615)

This commit is contained in:
Erik Montnemery 2022-03-24 14:15:09 +01:00 committed by GitHub
parent 3068c9c9d3
commit cbf5b5ead5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,7 +82,8 @@ async def ws_get_statistics_metadata(
hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
) -> None: ) -> None:
"""Get metadata for a list of statistic_ids.""" """Get metadata for a list of statistic_ids."""
statistic_ids = await hass.async_add_executor_job( instance: Recorder = hass.data[DATA_INSTANCE]
statistic_ids = await instance.async_add_executor_job(
list_statistic_ids, hass, msg.get("statistic_ids") list_statistic_ids, hass, msg.get("statistic_ids")
) )
connection.send_result(msg["id"], statistic_ids) connection.send_result(msg["id"], statistic_ids)