Skip to content

Conversation

simolus3
Copy link
Contributor

@simolus3 simolus3 commented Aug 8, 2025

In #105, the throttledUpdatedTables stream was shared between different connections connecting to a database worker. That's a problem, because the've been implemented as a single-subscription stream, so only the first subscription would have been successful.

This:

  1. Replaces throttledUpdatedTables with a non-throttled variant that supports multiple subscriptions. The stream can still be throttled by pausing the subscription, which will emit items into a pending set internally.
  2. On native platforms, removes the throttle entirely. Sending isolate messages isn't that expensive, we only do it once per transaction, and there's still the regular throttling logic for watched queries downstream.
  3. On the web, we pause the subscription while the client is busy handling the notification, giving us backpressure support without a fixed delay after each message.

I've tested package:powersync_core web tests with these changes and also ran a demo app with this to ensure it works.

@simolus3 simolus3 requested a review from stevensJourney August 8, 2025 15:03
Copy link
Contributor

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

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

The logic looks solid to me.

@simolus3 simolus3 merged commit 6705d13 into main Aug 8, 2025
6 checks passed
@simolus3 simolus3 deleted the throttled-updates-multi-subscriptions branch August 8, 2025 15:44
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