From 1a588760b9882d80d280518160a216a5f9bc7f25 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Sat, 1 Jun 2024 23:51:17 +0200 Subject: [PATCH] Avoid future exception during setup of Synology DSM (#118583) * avoid future exception during integration setup * clear future flag during setup * always clear the flag (with comment) --- homeassistant/components/synology_dsm/common.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/homeassistant/components/synology_dsm/common.py b/homeassistant/components/synology_dsm/common.py index 98a57319f93..e2023aa91a1 100644 --- a/homeassistant/components/synology_dsm/common.py +++ b/homeassistant/components/synology_dsm/common.py @@ -104,6 +104,11 @@ class SynoApi: except BaseException as err: if not self._login_future.done(): self._login_future.set_exception(err) + with suppress(BaseException): + # Clear the flag as its normal that nothing + # will wait for this future to be resolved + # if there are no concurrent login attempts + await self._login_future raise finally: self._login_future = None