Further reduce log verbosity for kucoin 429000 exception

This commit is contained in:
Matthias 2021-12-27 17:15:30 +01:00
parent bb65621134
commit 05a488a7a0

View File

@ -82,7 +82,7 @@ def retrier_async(f):
except TemporaryError as ex:
msg = f'{f.__name__}() returned exception: "{ex}". '
if count > 0:
logger.warning(msg + f'Retrying still for {count} times.')
msg += f'Retrying still for {count} times.'
count -= 1
kwargs['count'] = count
if isinstance(ex, DDosProtection):
@ -92,10 +92,14 @@ def retrier_async(f):
log_once_warning(
f"Kucoin 429 error, avoid triggering DDosProtection backoff delay. "
f"{count} tries left before giving up")
# Reset msg to avoid logging too many times.
msg = ''
else:
backoff_delay = calculate_backoff(count + 1, API_RETRY_COUNT)
logger.info(f"Applying DDosProtection backoff delay: {backoff_delay}")
await asyncio.sleep(backoff_delay)
if msg:
logger.warning(msg)
return await wrapper(*args, **kwargs)
else:
logger.warning(msg + 'Giving up.')