Don't forget to close WS session

This commit is contained in:
Matthias 2023-08-10 21:23:57 +02:00
parent c18b6cdb74
commit 55bd7db022

View File

@ -271,6 +271,11 @@ class Exchange:
):
logger.debug("Closing async ccxt session.")
self.loop.run_until_complete(self._api_async.close())
if (self._ws_async and inspect.iscoroutinefunction(self._ws_async.close)
and self._ws_async.session):
logger.debug("Closing ws ccxt session.")
self.loop.run_until_complete(self._ws_async.close())
if self.loop and not self.loop.is_closed():
self.loop.close()