Extract close method for exchange

This commit is contained in:
Matthias
2021-02-06 10:22:59 +01:00
parent 4ce4eadc23
commit b5177eadab
2 changed files with 4 additions and 0 deletions

View File

@@ -147,6 +147,9 @@ class Exchange:
"""
Destructor - clean up async stuff
"""
self.close()
def close(self):
logger.debug("Exchange object destroyed, closing async loop")
if self._api_async and inspect.iscoroutinefunction(self._api_async.close):
asyncio.get_event_loop().run_until_complete(self._api_async.close())