handle cancellation

This commit is contained in:
J. Nick Koston 2024-01-12 16:17:53 -10:00
parent 84dd2984ea
commit d0b4fe3fc6
No known key found for this signature in database

View File

@ -153,6 +153,7 @@ class TPLinkSmartHomeProtocol:
continue continue
except BaseException as ex: except BaseException as ex:
# Likely something cancelled the task so we need to close the connection # Likely something cancelled the task so we need to close the connection
# as we are not in an indeterminate state
self.close_without_wait() self.close_without_wait()
_LOGGER.debug( _LOGGER.debug(
"%s: BaseException during connect, closing connection: %s", "%s: BaseException during connect, closing connection: %s",
@ -179,6 +180,7 @@ class TPLinkSmartHomeProtocol:
) )
except BaseException as ex: except BaseException as ex:
# Likely something cancelled the task so we need to close the connection # Likely something cancelled the task so we need to close the connection
# as we are not in an indeterminate state
self.close_without_wait() self.close_without_wait()
_LOGGER.debug( _LOGGER.debug(
"%s: BaseException during query, closing connection: %s", "%s: BaseException during query, closing connection: %s",