diff options
| author | eunhhu <[email protected]> | 2026-09-29 18:04:01 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-29 18:04:01 +0100 |
| commit | 685cafa8f976fdd94168cfc933ad5389f8b4c617 (patch) | |
| tree | e6c140a1a6c57f8a2f06d7c2f23eb301bb6a29ce /core/module-save.c | |
| parent | 7ac82a749062bd321e2bb68c22d1e6efafdb55b7 (diff) | |
| download | pure-685cafa8f976fdd94168cfc933ad5389f8b4c617.tar.gz pure-685cafa8f976fdd94168cfc933ad5389f8b4c617.zip | |
Hold an app uncertain whatever its save changed, not only a list
A save whose tree commit may or may not be stored leaves the app apart
from its store: no save may follow until it starts again from what the
store has. The app was marked so only when the save also logged a list's
change, so a save of numbers alone that came back uncertain let the next
event (a list's alone) save on the state the memory had rolled back to:
after a restart, count 1 and a row made from count 0 (review 004, F2).
Now any uncertain tree commit marks it; a failed one still takes back
the logged entry. test-module's uncertain_numbers does the review's
case: the list's event is refused, and the store is the commit's.
Diffstat (limited to 'core/module-save.c')
| -rw-r--r-- | core/module-save.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/module-save.c b/core/module-save.c index dbf45a9..d38437f 100644 --- a/core/module-save.c +++ b/core/module-save.c @@ -895,12 +895,11 @@ PureResult pure_save_commit(PureApp *app, const double *values, void *const *doc free(payload); if (result == PURE_OK && tree) { result = app->data.save(app->data.context, documents, document_count, drafts, count, revisions); - /* The logged entry is on the device: taken back when the tree's commit - * failed, or, when that may yet be stored, no save follows. */ - if (result != PURE_OK && payload_size) { - if (result == PURE_UNCERTAIN) app->uncertain = true; - else pure_log_retract(app->log); - } + /* A commit that may yet be stored leaves the app apart from its store, + * whatever the save changed: no save follows until it starts again. + * One that failed takes back the logged entry, which is on the device. */ + if (result == PURE_UNCERTAIN) app->uncertain = true; + else if (result != PURE_OK && payload_size) pure_log_retract(app->log); } if (result == PURE_OK) { for (size_t k = 0; k < count; ++k) |
