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.
pull/127450/head
Stefan Agner 2024-10-03 15:37:29 +02:00 committed by GitHub
parent bbf8a49ac8
commit e15ae6bea3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

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: