Fix pending uploads on reconnect - #26
Open
julianallchin wants to merge 1 commit into
Open
Conversation
julianallchin
marked this pull request as ready for review
September 10, 2026 00:54
simolus3
reviewed
Sep 10, 2026
Comment on lines
+135
to
+146
| // Let the download actor's upload trigger arrive before the upload | ||
| // actor receives Connect. No new writes should be needed afterward. | ||
| assert!(future::poll_once(connect.as_mut()).await.is_none()); | ||
| assert!(future::poll_once(&mut download).await.is_none()); | ||
| assert!(future::poll_once(&mut upload).await.is_none()); | ||
| assert!(future::poll_once(&mut download).await.is_none()); | ||
| assert!(future::poll_once(connect.as_mut()).await.is_none()); | ||
| assert!(future::poll_once(&mut upload).await.is_none()); | ||
| assert!(future::poll_once(connect.as_mut()).await.is_some()); | ||
|
|
||
| assert_eq!(uploads.load(Ordering::SeqCst), 1); | ||
| assert!(db.next_crud_transaction().await.unwrap().is_none()); |
Collaborator
There was a problem hiding this comment.
This feels absurdly specific and fragile.
What we want to test is that calling connect() eventually emits upload_data even without any additional local writes. So give the connector the writing end of an async channel, send in upload_data and make the test wait on the reading end.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
ConnectRoot cause
The download actor can trigger an upload while the upload actor is still disconnected. That trigger is dropped, leaving offline writes queued until another local write occurs. An initial queue notification makes connecting check the existing backlog.
Validation
cargo +1.97.1 test -p powersynccargo +1.97.1 clippy -p powersync --all-targets -- -D warningsThe regression fails before the fix and passes afterward, without sleeps or a live service.