From 0b0d3a2091f398240b825540e372230f4252f09d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 20 Mar 2024 22:32:43 -1000 Subject: [PATCH] Add run_immediately to the trace stop listener (#113922) --- homeassistant/components/trace/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/trace/__init__.py b/homeassistant/components/trace/__init__.py index d0ec4555376..a7ad576e53d 100644 --- a/homeassistant/components/trace/__init__.py +++ b/homeassistant/components/trace/__init__.py @@ -68,7 +68,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: _LOGGER.error("Error storing traces", exc_info=exc) # Store traces when stopping hass - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_store_traces_at_stop) + hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_STOP, _async_store_traces_at_stop, run_immediately=True + ) return True