mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-17 05:11:15 +00:00
@@ -342,8 +342,22 @@ class Telegram(RPCHandler):
|
||||
self._loop.run_until_complete(self._startup_telegram())
|
||||
|
||||
async def _startup_telegram(self) -> None:
|
||||
retries = 3
|
||||
attempt = 0
|
||||
while attempt < retries:
|
||||
try:
|
||||
await self._app.initialize()
|
||||
await self._app.start()
|
||||
break
|
||||
except Exception as ex:
|
||||
logger.error(
|
||||
"Error starting Telegram bot (attempt %d/%d): %s", attempt + 1, retries, ex
|
||||
)
|
||||
attempt += 1
|
||||
if attempt == retries:
|
||||
logger.warning("Telegram init failed.")
|
||||
return
|
||||
await asyncio.sleep(2)
|
||||
if self._app.updater:
|
||||
await self._app.updater.start_polling(
|
||||
bootstrap_retries=-1,
|
||||
|
||||
Reference in New Issue
Block a user