From c615e1bc629fb048525bc9bb15bc6d2dd6a13537 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 17 Aug 2022 14:31:40 +0200 Subject: [PATCH] Avoid loop error during ccxt tests --- freqtrade/exchange/exchange.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index d74a01f8b..0a7609148 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2255,10 +2255,14 @@ class Exchange: coros = [self.get_market_leverage_tiers(symbol) for symbol in sorted(symbols)] + async def gather_results(): + return await asyncio.gather(*input_coro, return_exceptions=True) + for input_coro in chunks(coros, 100): - results = self.loop.run_until_complete( - asyncio.gather(*input_coro, return_exceptions=True)) + with self._loop_lock: + results = self.loop.run_until_complete(gather_results()) + for symbol, res in results: tiers[symbol] = res