Skip to content

feat: throttle Watch<T> and OnChange#50

Open
LucDeCaf wants to merge 6 commits intomainfrom
feat/throttle-watched
Open

feat: throttle Watch<T> and OnChange#50
LucDeCaf wants to merge 6 commits intomainfrom
feat/throttle-watched

Conversation

@LucDeCaf
Copy link
Contributor

@LucDeCaf LucDeCaf commented Mar 5, 2026

Adds throttling to Watch<T> and OnChange. The first event is emitted immediately upon being received, and any subsequent events that fall in the throttle window are accumulated + deduped until the throttle times out.

Benchmarks

  • Using ThrottleMs = 30 (default)
  • Watch query: SELECT COUNT(*) AS count FROM assets
  • Execute query: INSERT INTO assets (id, description, make) VALUES (uuid(), 'some desc', 'some make')
Number of Execute calls Number of events fired to Watch
Unthrottled 1000 1000
Throttled 1000 4
Unthrottled 10000 10000
Throttled 10000 32-35

Tasks

  • Throttle core OnRawTableChange function
  • Test with OnChange
  • Test with Watch
  • Test ExecuteBatch behaviour
    • OnChange receives one event post-transaction
    • Watch receives one event post-transaction

@LucDeCaf LucDeCaf marked this pull request as ready for review March 5, 2026 11:20
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.

1 participant