mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Suppress CancelledError in zwave-js unload (#91222)
This commit is contained in:
parent
237faf62ac
commit
4e78bcb236
@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
from collections import defaultdict
|
||||
from collections.abc import Coroutine
|
||||
from contextlib import suppress
|
||||
from typing import Any
|
||||
|
||||
from async_timeout import timeout
|
||||
@ -792,7 +793,11 @@ async def disconnect_client(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
for task in platform_setup_tasks:
|
||||
task.cancel()
|
||||
|
||||
await asyncio.gather(listen_task, start_client_task, *platform_setup_tasks)
|
||||
tasks = (listen_task, start_client_task, *platform_setup_tasks)
|
||||
await asyncio.gather(*tasks, return_exceptions=True)
|
||||
for task in tasks:
|
||||
with suppress(asyncio.CancelledError):
|
||||
await task
|
||||
|
||||
if client.connected:
|
||||
await client.disconnect()
|
||||
|
Loading…
x
Reference in New Issue
Block a user