Skip to content

Sync isolate: Use updatesSync #318

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

Merged
merged 1 commit into from
Aug 14, 2025
Merged

Sync isolate: Use updatesSync #318

merged 1 commit into from
Aug 14, 2025

Conversation

simolus3
Copy link
Contributor

In powersync-ja/sqlite_async.dart#105, we've fixed the updated stream to be based on synchronous udpate hooks behind the scenes, avoiding a growing async buffer for long-running writes that don't yield back to Dart.

Unfortunately, I've missed that the sync isolate uses a raw CommonDatabase and the updates stream, so the original issue is not actually fixed. This changes that to updatesSync. I've verified this with a one million item sync in the todolist sample (so there are also fts5 rows being created here). This reduces the amount of live update notifications from growing and reaching 2M+ items (old) to hovering from 0-60k before being GCed (new).

I think a better fix would be to obtain a sqlite_async database instead of the underlying one, since that would eventually allow us to move to the update hook implementation in the core extension. But this seems like an obvious fix with little chance for regressions.

@simolus3 simolus3 requested a review from rkistner August 14, 2025 10:57
@simolus3 simolus3 merged commit 801c23c into main Aug 14, 2025
5 checks passed
@simolus3 simolus3 deleted the sync-isolate-updatesSync branch August 14, 2025 11:52
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