Start tasks eagerly in for async_at_start(ed)

A few of these can avoid being scheduled on the loop
during startup
This commit is contained in:
J. Nick Koston
2024-03-08 21:05:17 -10:00
parent 6a2f7a6347
commit 3fbab042fc

View File

@@ -30,7 +30,7 @@ def _async_at_core_state(
"""
at_start_job = HassJob(at_start_cb)
if check_state(hass):
hass.async_run_hass_job(at_start_job, hass)
hass.async_run_hass_job(at_start_job, hass, eager_start=True)
return lambda: None
unsub: None | CALLBACK_TYPE = None
@@ -38,7 +38,7 @@ def _async_at_core_state(
@callback
def _matched_event(event: Event) -> None:
"""Call the callback when Home Assistant started."""
hass.async_run_hass_job(at_start_job, hass)
hass.async_run_hass_job(at_start_job, hass, eager_start=True)
nonlocal unsub
unsub = None