[upd/telegram]: improve stability, safety and production robustness#150
Merged
Schrolli91 merged 1 commit intoBOSWatch:developfrom Feb 8, 2026
Merged
[upd/telegram]: improve stability, safety and production robustness#150Schrolli91 merged 1 commit intoBOSWatch:developfrom
Schrolli91 merged 1 commit intoBOSWatch:developfrom
Conversation
Updated the Telegram plugin to handle high-load scenarios and prevent resource exhaustion. Key focus areas were message formatting, concurrency management, and configuration resilience. - Implement bounded message queue (max 100) with non-blocking drops to prevent memory leaks - Add graceful shutdown logic with worker thread joining and queue draining - Add self-healing initialization (`_ensure_sender`) to handle race conditions during startup - Implement robust escaping/sanitization for HTML and MarkdownV2 parse modes - Enforce Telegram's 4096 character limit with graceful truncation - Enhance error diagnostics for API responses (Rate limiting, 4xx/5xx errors) - Validate and sanitize GPS coordinates (range and type checking) - Decouple logging from global config by using module-level logger Behavioral Changes: - BREAKING: Location messages now require `coordinates: true` in config (previously default) - Messages are dropped with an error log when the queue is full (prevents system hang) - Invalid HTML/Markdown characters are now automatically escaped to prevent API errors
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.
Servus,
bei der Verwendung von
parse_modeund der Verarbeitung von{MSG}mit Sonderzeichen (z.B. ">") hat sich das Plugin verschluckt, da hier die Zeichen u.U. als Formatierungs-Tags erkannt worden sind.Zudem haben die fehlenden lat und lon-Felder im Packet (wenn Geomodul nicht aktiviert) immer für jeweils zwei WARNING Einträge im Log gesorgt.
Außerdem wird ein eigenes asynchrones Queueing eingeführt, um die blockierende Ausführung im Haupt-Router zu verhindern. Dadurch bleibt der Server auch bei Netzwerkverzögerungen oder API-Timeouts voll reaktionsfähig für weitere Packets. Dies ist notwendig, da z.T. mehrere Sekunden Wartezeit entstehen.
Wichtigste Änderungen
1. Asynchrone Verarbeitung & Stabilität
2. Proaktive Fehlervermeidung (Telegram API)
<b>,<i>, etc.) erhalten bleiben.3. Architektur-Konformität (Logging & Init)
Verhaltensänderungen
coordinates: truein der Konfiguration gesetzt ist. Dies reduziert unnötige Log-Einträge (z.B.[WARNING ] field not found: lat) bei Alarmen ohne Geodaten.Diese Opt-In-Regelung ist notwendig, um die WARNINGS zu umgehen. Bricht leider mit aktuellen configs (da nun Opt-in). Ich bekomme es aber leider nicht anders gelöst.
Da wir uns jedoch noch im Development befinden, denke ich nicht, dass es sehr viele User derzeit betrifft.
In der Hoffnung, dass es jetzt dann ausgereift ist :)