Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] CRUD upload retries #205

Merged
merged 1 commit into from
Jun 10, 2024
Merged

[Fix] CRUD upload retries #205

merged 1 commit into from
Jun 10, 2024

Conversation

stevensJourney
Copy link
Collaborator

Overview

A bug was recently discovered where CRUD uploads would not retry (for a long time) after failing when using the WebSocket connection method.

This was due to a failed upload updating the connection status to connected: false. Following CRUD loop iterations would check the connection status and exit if not connected.

The connection status is usually updated to true whenever a sync event is received from the PowerSync backend server. For the HTTP method keep-alive events are sent at regular intervals which will update the status back to connected: true. This is not the case for WebSockets as that method handles keep-alive events internally.

This PR aligns the CRUD upload connection status logic with the Dart SDK. The connection status is not set to false if an upload fails. It is only set to false if the connection to the backend server is closed. Reference here: https://github.com/powersync-ja/powersync.dart/blob/d812f78a5ae830e4ccdf29e1cb0a76aa27b01042/packages/powersync/lib/src/streaming_sync.dart#L102

Testing

Unit tests have been added to ensure CRUD uploads are correctly triggered and retried.

@stevensJourney stevensJourney marked this pull request as ready for review June 6, 2024 16:37
@stevensJourney stevensJourney merged commit 1b66145 into main Jun 10, 2024
2 checks passed
@stevensJourney stevensJourney deleted the fix/upload-retries branch June 10, 2024 07: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.

3 participants