From e15ae6bea33e87ba17cbc42c785947f500963cb7 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 3 Oct 2024 15:37:29 +0200 Subject: [PATCH] Cancel listen task when setting the Matter fabric label fails (#127423) When setting the Matter fabric label fails, the listen task should be cancelled to prevent the task from running indefinitely. Follow up for #127252. --- homeassistant/components/matter/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/matter/__init__.py b/homeassistant/components/matter/__init__.py index 8aa79aae86b..e751387d7e8 100644 --- a/homeassistant/components/matter/__init__.py +++ b/homeassistant/components/matter/__init__.py @@ -139,6 +139,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: hass.config.location_name or "Home" ) except (NotConnected, MatterError) as err: + listen_task.cancel() raise ConfigEntryNotReady("Failed to set default fabric label") from err if DOMAIN not in hass.data: