Fix settings sync logic for key-value pairs that never stop updating#2818
Conversation
…wait The reset-on-every-change debounce in useBlueOsStorage never persisted a value that kept changing faster than the debounce interval (e.g. live map camera, in-progress mission edits), so those keys were only written to BlueOS once the value went quiet. Clamp the debounce against a max-wait so a pending value is forced out after at most `settingsSyncMaxWaitMs`, and name the previously-magic debounce interval.
Automated PR Review (Claude)0. SummaryVerdict: MINOR SUGGESTIONS Minor items to address: 1.1, 6.1. This PR fixes a real bug in 1. Correctness & Implementation Bugs1.1 ( 2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX — ✅6. Code Quality & Style6.1 ( 7. Commit Hygiene — ✅8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional — ✅Generated by Claude. This is advisory; a human reviewer must still approve. |
…nfigurable Add an optional per-key options argument so callers can override the write debounce and max-wait, falling back to the named default constants. Lets high-frequency keys tune their checkpoint cadence instead of sharing one hard-coded interval.
1ad0785 to
984c2cf
Compare
Review follow-up — round 1Done
Won't change (with reasoning)
|
|
/review |
Automated PR Re-review 2 (Claude)Comparing Previous findings status
Discussion since last review
New findings0. SummaryVerdict: READY TO MERGE The incremental change renames the module-level constants to 1. Correctness & Implementation Bugs — ✅2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX — ✅6. Code Quality & Style — ✅7. Commit Hygiene — ✅8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional — ✅Generated by Claude. This is advisory; a human reviewer must still approve. |
|
Ready. |
When a settings keep being updated, like the odometer implemented on #2676, the value is never pushed to the vehicle, since it never stops being updated and the timeout for pushing (debounce) never resets.
This PR introduces the usage of
maxWait, so every few seconds (30), the value is pushed independently of it not having stalled.It also introduces support for callers to configure both the debouncing and maxWait times.