From 4d75940cd21d183414c290c6c778bb75936a0763 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 17 Mar 2024 08:16:26 -1000 Subject: [PATCH] Start and stop template cache watcher to run_immediately (#113644) --- homeassistant/helpers/template.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index 62652e15be9..20140c28ba1 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -209,8 +209,12 @@ def async_setup(hass: HomeAssistant) -> bool: cancel = async_track_time_interval( hass, _async_adjust_lru_sizes, timedelta(minutes=10) ) - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, _async_adjust_lru_sizes) - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, callback(lambda _: cancel())) + hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_START, _async_adjust_lru_sizes, run_immediately=True + ) + hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_STOP, callback(lambda _: cancel()), run_immediately=True + ) return True