mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Ensure shutdown of async exchange, fix test
This commit is contained in:
parent
d42e012ec3
commit
2ade5191e6
|
@ -55,8 +55,12 @@ class ExchangeWS:
|
|||
logger.debug("Stopped")
|
||||
|
||||
async def _cleanup_async(self) -> None:
|
||||
await self.ccxt_object.close()
|
||||
self.__cleanup_called = True
|
||||
try:
|
||||
await self.ccxt_object.close()
|
||||
except Exception:
|
||||
logger.exception("Exception in _cleanup_async")
|
||||
finally:
|
||||
self.__cleanup_called = True
|
||||
|
||||
def cleanup_expired(self) -> None:
|
||||
"""
|
||||
|
|
|
@ -46,6 +46,7 @@ async def test_exchangews_ohlcv(mocker):
|
|||
config = MagicMock()
|
||||
ccxt_object = MagicMock()
|
||||
ccxt_object.watch_ohlcv = AsyncMock()
|
||||
ccxt_object.close = AsyncMock()
|
||||
mocker.patch("freqtrade.exchange.exchange_ws.ExchangeWS._start_forever", MagicMock())
|
||||
|
||||
exchange_ws = ExchangeWS(config, ccxt_object)
|
||||
|
|
Loading…
Reference in New Issue
Block a user