Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web] Flush at the end of each writeLock #77

Merged
merged 3 commits into from
Nov 6, 2024
Merged

[Web] Flush at the end of each writeLock #77

merged 3 commits into from
Nov 6, 2024

Conversation

rkistner
Copy link
Contributor

@rkistner rkistner commented Nov 4, 2024

The IndexedDB-based filesystem used by default for web flushes any changed pages in the background. This can cause data loss: Data that appears to be written (transaction returned successfully) have not actually been persisted to disk.

This now does an explicit flush() on the filesystem after every write transaction or statement. This can have significant performance overhead for some usage patterns, so this can be disabled on a per-transaction level.

The flush: false option is a niche use-case, so only exposed on the WebSqliteConnection abstract class, and not the more general SqliteConnection.

See an example of using the flush option here: powersync-ja/powersync.dart#208

@rkistner rkistner marked this pull request as ready for review November 5, 2024 12:25
stevensJourney
stevensJourney previously approved these changes Nov 5, 2024
 - sqlite_async@0.11.0
 - drift_sqlite_async@0.2.0-alpha.4
@rkistner rkistner merged commit 1e64f5d into main Nov 6, 2024
7 checks passed
@rkistner rkistner deleted the web-flush branch November 6, 2024 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants