Avoid creating tasks in homeassistant_alerts when the debouncer will not fire (#113580)

This commit is contained in:
J. Nick Koston 2024-03-16 10:20:06 -10:00 committed by GitHub
parent 4174d88ad7
commit bb12d2e865
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 58 additions and 55 deletions

View File

@ -98,11 +98,14 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
function=coordinator.async_refresh, function=coordinator.async_refresh,
) )
async def _component_loaded(_: Event) -> None: @callback
await refresh_debouncer.async_call() def _component_loaded(_: Event) -> None:
refresh_debouncer.async_schedule_call()
await coordinator.async_refresh() await coordinator.async_refresh()
hass.bus.async_listen(EVENT_COMPONENT_LOADED, _component_loaded) hass.bus.async_listen(
EVENT_COMPONENT_LOADED, _component_loaded, run_immediately=True
)
async_at_start(hass, initial_refresh) async_at_start(hass, initial_refresh)