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)
This commit is contained in:
Michael 2024-06-01 23:51:17 +02:00 committed by Paulus Schoutsen
parent 6ba9e7d5fd
commit 1a588760b9

View File

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