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.
This commit is contained in:
Stefan Agner
2024-10-03 15:37:29 +02:00
committed by GitHub
parent bbf8a49ac8
commit e15ae6bea3

View File

@@ -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: