Skip to content

fix: only clear dirty state on successful push_state_update()#109

Merged
cmroche merged 2 commits intocmroche:masterfrom
mlesniew:push_state_update_dirty_fix
Jan 10, 2026
Merged

fix: only clear dirty state on successful push_state_update()#109
cmroche merged 2 commits intocmroche:masterfrom
mlesniew:push_state_update_dirty_fix

Conversation

@mlesniew
Copy link
Contributor

The Device.push_state_update method only pushes values of properties, which were actually changed. This is tracked using the _dirty instance variable.

So far, 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.

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
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.69%. Comparing base (07f0390) to head (11b3c1f).
⚠️ Report is 3 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cmroche cmroche changed the title Fix push_state_update to only clear dirty properties on success fix: only clear dirty state on successful push_state_update() Jan 10, 2026
@cmroche
Copy link
Owner

cmroche commented Jan 10, 2026

Thanks for the fix.

@cmroche cmroche merged commit a9d7107 into cmroche:master Jan 10, 2026
11 checks passed
@github-actions
Copy link

🎉 This PR is included in version 2.1.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants