mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 18:28:14 +02:00
Refactor integration startup time tracking to reduce overhead (#110136)
* Refactor integration startup time tracking to reduce overhead - Use monotonic time for watching integration startup time as it avoids incorrect values if time moves backwards because of ntp during startup and reduces many time conversions since we want durations in seconds and not local time - Use loop scheduling instead of a task - Moves all the dispatcher logic into the new _WatchPendingSetups * websocket as well * tweaks * simplify logic * preserve logic * preserve logic * lint * adjust
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
import datetime as dt
|
||||
from functools import lru_cache, partial
|
||||
import json
|
||||
import logging
|
||||
@ -540,13 +539,12 @@ def handle_integration_setup_info(
|
||||
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
|
||||
) -> None:
|
||||
"""Handle integrations command."""
|
||||
setup_time: dict[str, float] = hass.data[DATA_SETUP_TIME]
|
||||
connection.send_result(
|
||||
msg["id"],
|
||||
[
|
||||
{"domain": integration, "seconds": timedelta.total_seconds()}
|
||||
for integration, timedelta in cast(
|
||||
dict[str, dt.timedelta], hass.data[DATA_SETUP_TIME]
|
||||
).items()
|
||||
{"domain": integration, "seconds": seconds}
|
||||
for integration, seconds in setup_time.items()
|
||||
],
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user