-
Notifications
You must be signed in to change notification settings - Fork 12
feat: adds group infor to heart beat #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
|
Go test coverage
Total coverage: 63.1% |
leoparente
reviewed
Oct 14, 2025
leoparente
approved these changes
Oct 14, 2025
Contributor
leoparente
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM
|
🎉 This PR is included in version 2.5.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 2.5.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
This pull request refactors the handling of group memberships in the fleet messaging system to improve management of group subscriptions, especially when receiving a full list of group memberships. The changes introduce a
GroupManagerto track group state, update theMessagingcomponent to use this manager, and enhance test coverage to account for these changes.Core logic improvements:
Messagingstruct now includes aGroupManagerto keep track of current group memberships, allowing for correct subscription and unsubscription when a full list of groups is received. (agent/configmgr/fleet/from_rpc.go[1] [2]handleGroupMembershipsmethod now unsubscribes from topics that are no longer part of the full group list and removes them from theGroupManager, ensuring that the agent's subscriptions match the authoritative list from the server. (agent/configmgr/fleet/from_rpc.goagent/configmgr/fleet/from_rpc.goL96-R120)Constructor and dependency updates:
NewMessagingandNewMQTTConnectionconstructors are updated to require and pass aGroupManagerinstance, ensuring consistent group state management across the system. (agent/configmgr/fleet/from_rpc.go[1]agent/configmgr/fleet/connection.go[2]Testing improvements:
GroupManagertoNewMessaging, and to provide mock unsubscribe functions where necessary to fully exercise the new logic. (agent/configmgr/fleet/from_rpc_test.go[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]Refactoring for clarity and maintainability:
handleGroupMembershipsis simplified to accept aTopicActionsstruct containing subscribe, publish, and unsubscribe functions, making the code easier to extend and maintain. (agent/configmgr/fleet/from_rpc.go[1] [2]Test logic enhancements:
agent/configmgr/fleet/from_rpc_test.go[1] [2] [3] [4] [5] [6] [7]These changes collectively improve the robustness and correctness of group membership handling in the agent's messaging system.