From 2739984aed2cf3d2b8b4b0a7226cdefda9d123da Mon Sep 17 00:00:00 2001 From: viettranx Date: Mon, 23 Mar 2026 12:04:49 +0700 Subject: [PATCH] fix(telegram): resolve getUpdates long-poll timeout race (#361) HTTP client timeout (30s) equaled getUpdates API timeout (30s), causing context deadline exceeded errors (~210/hr) when Telegram held the long-poll for the full duration. Increase HTTP client to 60s, reduce getUpdates to 25s for 35s headroom. Closes #361 --- internal/channels/telegram/channel.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/channels/telegram/channel.go b/internal/channels/telegram/channel.go index 4c328f90..8cbbeeaf 100644 --- a/internal/channels/telegram/channel.go +++ b/internal/channels/telegram/channel.go @@ -83,7 +83,7 @@ func New(cfg config.TelegramConfig, msgBus *bus.MessageBus, pairingSvc store.Pai } httpClient := &http.Client{ - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, // Must exceed getUpdates Timeout to avoid long-poll race (#361) Transport: transport, } // Apply ForceIPv4 at init if configured (explicit, predictable, no runtime heuristic). @@ -139,7 +139,7 @@ func (c *Channel) Start(ctx context.Context) error { c.pollDone = make(chan struct{}) updates, err := c.bot.UpdatesViaLongPolling(pollCtx, &telego.GetUpdatesParams{ - Timeout: 30, + Timeout: 25, // Long-poll seconds; keep below HTTP client Timeout (#361) AllowedUpdates: []string{ "message", "edited_message",