Skip to content

Conversation

simolus3
Copy link
Contributor

We generally have mechanisms in place that try to prevent duplicate sync state events being emitted by statusStream. In the powersync mixin however, we apply a transformation on incoming events to set hasSynced (a field that is not set on the events that method receives). This means that incoming events only differing due to hasSynced being absent effectively cause us to re-emit the last snapshot.

I've also added a call to close the stream when the database is closed (generally useful to free up listeners, and also makes testing this easier).

Closes #224

Copy link
Contributor

@rkistner rkistner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy with the changes, but we need to get the builds passing again

stevensJourney
stevensJourney previously approved these changes Jan 16, 2025
@simolus3 simolus3 merged commit 5cd42bb into main Jan 16, 2025
7 checks passed
@simolus3 simolus3 deleted the fix/avoid-uplicate-sync-status-event branch January 16, 2025 14:31
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.

db.statusStream has a large # of contiguous duplicate SyncStatus messages, ~70% of all messages are duplicates

3 participants