Improve save protocol and SQLite pragmas#1036
Merged
GlassOfWhiskey merged 1 commit intomasterfrom Apr 19, 2026
Merged
Conversation
31cc17b to
d545e1e
Compare
LanderOtto
approved these changes
Apr 19, 2026
d545e1e to
a7875ff
Compare
Replace `persistence_lock: Lock` with `_saving: Event` in `PersistableEntity` so concurrent callers wait on a shared event rather than serialize through a mutex. Each `save` method also gains an early-return guard and moves follow-on writes (ports, steps, dependencies) inside the guarded block to avoid redundant work on re-entry. Remove `LocalTarget._get_deployment_config()` class-level singleton as it is no longer needed. Replace `PRAGMA wal_autocheckpoint` with `PRAGMA temp_store = MEMORY`, `PRAGMA foreign_keys = ON`, and `PRAGMA mmap_size` in the SQLite connection setup. Expose `mmap_size` as a configurable option (default 256 MiB) in the schema and `SqliteDatabase` constructor.
a7875ff to
70c8251
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1036 +/- ##
==========================================
- Coverage 74.25% 74.20% -0.06%
==========================================
Files 90 90
Lines 12461 12478 +17
Branches 2182 2186 +4
==========================================
+ Hits 9253 9259 +6
- Misses 2689 2696 +7
- Partials 519 523 +4 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace
persistence_lock: Lockwith_saving: EventinPersistableEntityso concurrent callers wait on a shared event rather than serialize through a mutex. Eachsavemethod also gains an early-return guard and moves follow-on writes (ports, steps, dependencies) inside the guarded block to avoid redundant work on re-entry. RemoveLocalTarget._get_deployment_config()class-level singleton as it is no longer needed.Replace
PRAGMA wal_autocheckpointwithPRAGMA temp_store = MEMORY,PRAGMA foreign_keys = ON, andPRAGMA mmap_sizein the SQLite connection setup. Exposemmap_sizeas a configurable option (default 256 MiB) in the schema andSqliteDatabaseconstructor.