Initial DataStore Sync Slow for Android Devices #4686
Labels
bug
Something is not working; the issue has reproducible steps and has been reproduced
datastore
Issues related to the DataStore Category
pending-release
Issues that have been addressed in main but have not been released
Hello,
My development team is having trouble with initial syncing using DataStore, specifically on Android.
Description of the issue:
After a fresh install of the app, and once a user signs in using Amplify's Authenticator widget, a user should be able to have access to models fetched from DataStore. We use
Amplify.DataStore.observeQuery()
to fetch this specific model.On iOS devices, the initial sync for DataStore seems to happen fast and
Amplify.DataStore.observeQuery()
fetches snapshots instantly. But it takes a long time for Android devices to sync data for the first time, resulting inobserveQuery()
fetching empty snapshots a multiple times, and finally fetching a complete snapshot.I noticed that observeQuery() on Android will fetch the complete snapshot once the following logs are shown on the terminal:
So my team reached a conclusion that DataStore takes long time for syncing the models. And we need your guidance to help resolve this issue. This has been an ongoing issue for almost a year, and we really hope to understand why initial DataStore sync is slow for Android devices. We can provide an obfuscated version of our code and/or GraphQL schema if it would help.
Also, are there best practices that would help data models to be synced faster? Our team was considering reducing the number of models being synced by using DataStoreSyncExpression to selectively sync certain models only. And we could choose to not sync some models that do not benefit from DataStore's local-first behavior in our use case. If this approach does not sound reasonable, please let us know what the proper best practices would be.
Misc information:
Flutter Version: 3.10.5
amplify_flutter Version: 1.4.1
amplify_datastore Version: 1.4.2
compileSdkVersion on android/app/build.gradle: 33
Thank you for your time!
The text was updated successfully, but these errors were encountered: