fix: only clear dirty state on successful push_state_update()#109
Merged
cmroche merged 2 commits intocmroche:masterfrom Jan 10, 2026
Merged
fix: only clear dirty state on successful push_state_update()#109cmroche merged 2 commits intocmroche:masterfrom
cmroche merged 2 commits intocmroche:masterfrom
Conversation
The `Device.push_state_update` method only pushes values of properties, which were actually changed. This is tracked using the `_dirty` instance variable. So fark, the `_dirty` flag was cleared unconditionally, before sending messages to the AC. This commit makes sure it is done only after successfully sending the message. In case of errors, the `_dirty` state will be preserved, so a subsequent call to `push_state_update` will re-attempt sending the same properties.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #109 +/- ##
=======================================
Coverage 95.69% 95.69%
=======================================
Files 8 8
Lines 743 743
=======================================
Hits 711 711
Misses 32 32 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Owner
|
Thanks for the fix. |
|
🎉 This PR is included in version 2.1.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
The
Device.push_state_updatemethod only pushes values of properties, which were actually changed. This is tracked using the_dirtyinstance variable.So far, the
_dirtyflag was cleared unconditionally, before sending messages to the AC. This commit makes sure it is done only after successfully sending the message. In case of errors, the_dirtystate will be preserved, so a subsequent call topush_state_updatewill re-attempt sending the same properties.