Extract close method for exchange

This commit is contained in:
Matthias
2021-02-06 10:22:59 +01:00
committed by crypto_rahino
parent b89744753e
commit f56e63895d
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())