Ensure shutdown of async exchange, fix test
This commit is contained in:
@@ -55,8 +55,12 @@ class ExchangeWS:
|
|||||||
logger.debug("Stopped")
|
logger.debug("Stopped")
|
||||||
|
|
||||||
async def _cleanup_async(self) -> None:
|
async def _cleanup_async(self) -> None:
|
||||||
await self.ccxt_object.close()
|
try:
|
||||||
self.__cleanup_called = True
|
await self.ccxt_object.close()
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Exception in _cleanup_async")
|
||||||
|
finally:
|
||||||
|
self.__cleanup_called = True
|
||||||
|
|
||||||
def cleanup_expired(self) -> None:
|
def cleanup_expired(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ async def test_exchangews_ohlcv(mocker):
|
|||||||
config = MagicMock()
|
config = MagicMock()
|
||||||
ccxt_object = MagicMock()
|
ccxt_object = MagicMock()
|
||||||
ccxt_object.watch_ohlcv = AsyncMock()
|
ccxt_object.watch_ohlcv = AsyncMock()
|
||||||
|
ccxt_object.close = AsyncMock()
|
||||||
mocker.patch("freqtrade.exchange.exchange_ws.ExchangeWS._start_forever", MagicMock())
|
mocker.patch("freqtrade.exchange.exchange_ws.ExchangeWS._start_forever", MagicMock())
|
||||||
|
|
||||||
exchange_ws = ExchangeWS(config, ccxt_object)
|
exchange_ws = ExchangeWS(config, ccxt_object)
|
||||||
|
|||||||
Reference in New Issue
Block a user