Properly handle shutdown (canceled coroutines)
This will imrove shutdown behavior
This commit is contained in:
@@ -102,8 +102,12 @@ class ExchangeWS:
|
|||||||
def _continuous_stopped(
|
def _continuous_stopped(
|
||||||
self, task: asyncio.Task, pair: str, timeframe: str, candle_type: CandleType):
|
self, task: asyncio.Task, pair: str, timeframe: str, candle_type: CandleType):
|
||||||
self._background_tasks.discard(task)
|
self._background_tasks.discard(task)
|
||||||
result = task.result()
|
if task.cancelled():
|
||||||
logger.info(f"{pair}, {timeframe} Task finished {result}")
|
result = "cancelled"
|
||||||
|
else:
|
||||||
|
result = task.result()
|
||||||
|
|
||||||
|
logger.info(f"{pair}, {timeframe} Task finished: {result}")
|
||||||
self._klines_scheduled.discard((pair, timeframe, candle_type))
|
self._klines_scheduled.discard((pair, timeframe, candle_type))
|
||||||
|
|
||||||
async def _continuously_async_watch_ohlcv(
|
async def _continuously_async_watch_ohlcv(
|
||||||
|
|||||||
Reference in New Issue
Block a user