Fix exception on exchange shutdown
This commit is contained in:
parent
78ccaae318
commit
39f8c5719b
@ -170,7 +170,9 @@ class Exchange:
|
|||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
logger.debug("Exchange object destroyed, closing async loop")
|
logger.debug("Exchange object destroyed, closing async loop")
|
||||||
if self._api_async and inspect.iscoroutinefunction(self._api_async.close):
|
if (self._api_async and inspect.iscoroutinefunction(self._api_async.close)
|
||||||
|
and self._api_async.session):
|
||||||
|
logger.info("Closing async ccxt session.")
|
||||||
asyncio.get_event_loop().run_until_complete(self._api_async.close())
|
asyncio.get_event_loop().run_until_complete(self._api_async.close())
|
||||||
|
|
||||||
def _init_ccxt(self, exchange_config: Dict[str, Any], ccxt_module: CcxtModuleType = ccxt,
|
def _init_ccxt(self, exchange_config: Dict[str, Any], ccxt_module: CcxtModuleType = ccxt,
|
||||||
|
@ -126,6 +126,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
|
|
||||||
self.rpc.cleanup()
|
self.rpc.cleanup()
|
||||||
cleanup_db()
|
cleanup_db()
|
||||||
|
self.exchange.close()
|
||||||
|
|
||||||
def startup(self) -> None:
|
def startup(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user