Skip to content

Commit 0933b37

Browse files
committed
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: 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
1 parent 9a8802a commit 0933b37

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

aw-datastore/src/worker.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,21 @@ impl DatastoreWorker {
294294
Err(e) => Err(e),
295295
},
296296
Command::SetKeyValue(key, data) => match ds.insert_key_value(tx, &key, &data) {
297-
Ok(()) => Ok(Response::Empty()),
297+
Ok(()) => {
298+
self.commit = true;
299+
Ok(Response::Empty())
300+
}
298301
Err(e) => Err(e),
299302
},
300303
Command::GetKeyValue(key) => match ds.get_key_value(tx, &key) {
301304
Ok(result) => Ok(Response::KeyValue(result)),
302305
Err(e) => Err(e),
303306
},
304307
Command::DeleteKeyValue(key) => match ds.delete_key_value(tx, &key) {
305-
Ok(()) => Ok(Response::Empty()),
308+
Ok(()) => {
309+
self.commit = true;
310+
Ok(Response::Empty())
311+
}
306312
Err(e) => Err(e),
307313
},
308314
Command::Close() => {

0 commit comments

Comments
 (0)