From f05590796e55e377bc045003083334154d32ee22 Mon Sep 17 00:00:00 2001 From: Bartok9 Date: Thu, 16 Apr 2026 03:03:43 -0700 Subject: [PATCH] fix(telegram): increase cold-boot retry budget and cap backoff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bump connect retry attempts from 3 to 8 and cap exponential backoff at 15 seconds. Old budget: 3 attempts, 1+2+4=7s total — insufficient for cold boot on slow networks or embedded devices. New budget: 8 attempts, 1+2+4+8+15+15+15=~60s total. Inspired by PR #5770 by @Bartok9 (re-implemented against current main since original was 913 commits stale with conflicts). --- gateway/platforms/telegram.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gateway/platforms/telegram.py b/gateway/platforms/telegram.py index 1bda152f..d5578961 100644 --- a/gateway/platforms/telegram.py +++ b/gateway/platforms/telegram.py @@ -665,14 +665,14 @@ class TelegramAdapter(BasePlatformAdapter): from telegram.error import NetworkError, TimedOut except ImportError: NetworkError = TimedOut = OSError # type: ignore[misc,assignment] - _max_connect = 3 + _max_connect = 8 for _attempt in range(_max_connect): try: await self._app.initialize() break except (NetworkError, TimedOut, OSError) as init_err: if _attempt < _max_connect - 1: - wait = 2 ** _attempt + wait = min(2 ** _attempt, 15) logger.warning( "[%s] Connect attempt %d/%d failed: %s — retrying in %ds", self.name, _attempt + 1, _max_connect, init_err, wait,