Skip to content

Commit d650c79

Browse files
committed
Add changeset for PR #1029 (awaitMatch performance fix)
1 parent 961ef49 commit d650c79

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

.changeset/fast-mirrors-wait.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@tanstack/electric-db-collection': patch
3+
---
4+
5+
Fix slow onInsert awaitMatch performance issue
6+
7+
The message buffer was being cleared at the start of each new batch, causing messages to be lost when multiple batches (including heartbeats) arrived before `awaitMatch` was called. This resulted in `awaitMatch` timing out (~3-5s per attempt) and transaction rollbacks.
8+
9+
The fix removes the buffer clearing between batches. Messages are now preserved until the buffer reaches MAX_BATCH_MESSAGES (1000), at which point the oldest messages are dropped. This ensures `awaitMatch` can find messages even when sync activity arrives before the API call completes.

0 commit comments

Comments
 (0)