fix: subscribe to topics on reconnection when session persistence is not enabled or broken#3462
Merged
reubenmiller merged 2 commits intothin-edge:mainfrom Mar 11, 2025
Conversation
Contributor
Robot Results
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
jarhodes314
approved these changes
Mar 11, 2025
…nce is disabled or broken Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
5195f72 to
0aff528
Compare
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.
Proposed changes
Resubscribe to MQTT topics on reconnection when the no session is present. No session is present when mosquitto persistence has not been configured, or inaccessible (e.g. corrupt or incorrect ownership/permissions).
Previously, the reconnection logic was assuming that the only time the client needs to resubscribe to the MQTT topics is when an anonymous session is used. However if the MQTT broker persistence layer is not working, then the client should be checking if a session is present or not, and then resubscribing to the topics if no session was restored.
The most notable symptom without this change was that the tedge-agent would stop reacting to operations sent via MQTT if it would be disconnected from the local MQTT broker and if the MQTT broker persistence layer was not working or enabled. Restarting the tedge-agent service would "fix" the situation but only until the next reconnection event.
Types of changes
Paste Link to the issue
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments