Fix/settings persistence on shutdown#582
Fix/settings persistence on shutdown#582RaoufGhrissi wants to merge 1 commit intoActivityWatch:masterfrom
Conversation
Problem: Settings changes (UI preferences, startOfWeek) were being lost on server shutdown because they were waiting for a 15-second background commit timer. Solution: Ensure that SetKeyValue and DeleteKeyValue commands set self.commit = true in the datastore worker, forcing immediate persistence. Steps to Reproduce: 1. Start aw-server-rust. 2. Change a setting (e.g. startOfWeek). 3. Immediately kill the server: pkill -TERM aw-server. 4. Restart and check the setting. Source: aw-datastore/src/worker.rs
0ab10fa to
0933b37
Compare
Greptile SummaryThis PR fixes settings data loss on ungraceful shutdown ( Confidence Score: 5/5Safe to merge — minimal, focused, two-line logic change with no risk of regression. The change is identical in structure to the already-correct CreateBucket/DeleteBucket handlers. No new state is introduced and the commit flag is properly reset at the top of each outer loop iteration (line 169), so there is no risk of spurious commits on subsequent unrelated requests. No P0 or P1 findings. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant DatastoreWorker
participant SQLite
Client->>DatastoreWorker: SetKeyValue / DeleteKeyValue
DatastoreWorker->>SQLite: insert_key_value / delete_key_value (within tx)
DatastoreWorker->>DatastoreWorker: self.commit = true
DatastoreWorker-->>Client: Response::Empty()
Note over DatastoreWorker: Inner loop checks self.commit == true → break
DatastoreWorker->>SQLite: tx.commit() [immediate]
Note over DatastoreWorker: Before fix: waited up to 15 s for commit_interval_passed
Reviews (1): Last reviewed commit: "feat(datastore): ensure settings changes..." | Re-trigger Greptile |
feat(datastore): ensure settings changes are persisted immediately
Problem:
Settings changes (UI preferences, startOfWeek) were being lost on server shutdown because they were waiting for a 15-second background commit timer.
Solution:
Ensure that SetKeyValue and DeleteKeyValue commands set self.commit = true in the datastore worker, forcing immediate persistence.
Steps to Reproduce:
Source:
aw-datastore/src/worker.rs