(fix): polling loop exits on HTTP client timeout, not only on context cancel
Golang lint / lint (push) Successful in 1m40s

(fix): HTTP client timeout too close to poll timeout

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 13:44:22 +03:00
co-authored by Claude Sonnet 4.6
parent c2f6406819
commit 38309e74f6
3 changed files with 29 additions and 18 deletions
+6
View File
@@ -1,5 +1,11 @@
# Changelog
## v1.0.2
### Fixed
- Fixed long-polling stopping permanently when the HTTP client's internal timeout fired. The polling loop was checking `errors.Is(err, context.DeadlineExceeded)`, which matched HTTP client timeout errors (`*url.Error` wraps `context.DeadlineExceeded`), causing the goroutine to exit as if the bot context was canceled. The check is now `ctx.Err() != nil` so only a real context cancellation stops polling.
- Fixed the HTTP client timeout (45 s) being too close to the long-poll `getUpdates` timeout (30 s default), leaving insufficient margin for connection setup and response transfer. The client timeout is now derived from the configured `PollTimeout` plus a 60-second buffer.
## v1.0.1
### Fixed