Repository navigation
fix: a new Telegram connection for each message, one more try (#295) - #296
Merged
Merged
Conversation
One Telegram message out of two timed out: the session kept the connection between messages hours apart, long dropped on the way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #295
What changes
Telegramno longer keeps arequests.Session. Each message goes out withrequests.poston a connection of its own. A session can still be passed in for tests.ConnectionError,Timeout) is tried once more after 3 s. An answer from Telegram, such as 400 "chat not found", is not tried again. The error never contains the token, as before.requests.post). CHANGELOG ("Unreleased").Why
From 2026-11-11 to 2026-11-16 the owner's server logged the Telegram sends as failed, OK, failed, OK… with
ReadTimeout. Telegram answers in about 0.1 s from the same container. After a successful send, the pooled connection is reused hours later, after it was dropped on the way, so the next message hangs until the 15 s timeout. Update messages then arrive 6 hours late; an alert is lost (the "unhealthy" alert of a VPN container on 2026-11-15).How it was tested
pytest: 94 passed.pyflakesis clean. Not tried by sending real messages, which would reach the owner's chat. On the server, the next days' log will show whether every send passes.Checklist (see AGENTS.md, "Before opening a pull request")
pyflakesandpytestpass; new behaviour or fixed bug has a testCHANGELOG.md/API.md/ README updated where neededReviewer (the other agent): run the tests, then comment "Review by : approved" or "Review by : changes requested" with the findings.
🤖 Generated with Claude Code