mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2379] [MERGED] Flush pending storage writes on app quit #5568
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#5568
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2379
Author: @Romuromylus
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Romuromylus
Base:
refactor← Head:fix/storage-flush-on-quit📝 Commits (2)
9a7e73cFlush pending storage writes on app quit76051acLog quit-time storage flush failures instead of swallowing them📊 Changes
2 files changed (+44 additions, -2 deletions)
View changed files
📝
src-tauri/crates/storage/src/lib.rs(+26 -0)📝
src-tauri/src/lib.rs(+18 -2)📄 Description
Linked issue
Closes #2319
Why this change
Storage writes are debounced ~750ms before hitting disk. The Tauri app exited via
.run(generate_context!())with no exit handler, so any write still inside the debounce window when the user closed the app was lost. TheDropbackstop onFileStorageis gated on being the sole cache owner, which the in-flight debounce thread defeats during exactly that window.What changed
.build(ctx).expect(...).run(|handle, event| ...), flushing storage onRunEvent::ExitRequested/RunEvent::Exitso pending writes are persisted before the process exits.FileStorageDropguard is intentionally left unchanged: dropping a still-shared, dirty storage (e.g. during a read-only health probe) must not eagerly persist seeded defaults; the explicit on-quit flush is the correct, scoped fix.Refactor impact
Primary owner: app shell + Rust storage (
src-tauri/src/lib.rs,src-tauri/crates/storage/src/lib.rs)Impact areas reviewed:
run()keeps its()signature, somain.rsis untouched.flush()drains the dirty cache synchronously and is already used on other paths.Boundary notes:
storage.flush()(public storage-crate API). No new cross-layer coupling.Pressure points touched:
src-tauri/src/lib.rs(run loop only — command registration unchanged)Validation
pnpm checkpasses before PR push/handoffManual verification notes
cargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace— green, including newflush_persists_pending_debounced_writes_to_disk(a dirty, not-yet-written collection lands on disk afterflush()and the dirty flag clears). Existinghealth_liveness_skips_writable_probe_by_defaultstill passes (Drop semantics unchanged).Feature Discoverability
Reason:
Docs and release impact
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.