You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0298b14
Browse filesBrowse the repository at this point in the historyBrowse files
fix(output): serialise status recording across threads
Component threads (GE Cloud, Solis, ...) call record_status() alongside the
main loop. The error_count attribute is a read-modify-write of the sensor's
own state, so two concurrent calls could both read N and both write N+1.
record_status() and record_status_under_warning() now share a status lock,
which also keeps each call's current_status/status_warning update whole.
It does not cover record_final_run_status()'s choice between them, which
reads had_errors outside the lock: a component warning landing between
that read and the write is still overwritten until the next run, as
before this change.
The status-change notification is sent after the lock is released: over
the websocket it waits on another thread for up to two minutes, which would
otherwise stall every other status write. The lock is kept out of the debug
dump, which serialises PredBat's attributes and can't pickle a lock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
("component_health_status", test_component_health_status, "Component errors fail the recorded run status tests", False),
517
517
("record_status_state_clamped", test_record_status_state_clamped, "Status sensor state is clamped at the 255 characters Home Assistant accepts", False),
518
518
("record_status_under_warning", test_record_status_under_warning, "A run's state is recorded in front of the warning it raised", False),
519
+
("record_status_concurrent", test_record_status_concurrent, "Concurrent record_status calls keep every error_count increment", False),
519
520
("dynamic_load_car", test_dynamic_load_car_slot_cancellation, "Dynamic load car slot cancellation tests", False),
0 commit comments