amplify-android icon indicating copy to clipboard operation
amplify-android copied to clipboard

DataStore waits too long before it's ready

Open haitv2910 opened this issue 3 years ago • 9 comments

Before opening, please confirm:

Language and Async Model

Kotlin

The DataStore query doesn't do anything on the first load of the app, so I tried to listen for the DataStoreChannelEventName.READY event, but it took 1 minute from opening the app to when it got into Event Ready. Is there a way to sync data faster

Amplify Categories

DataStore

Gradle script dependencies

// Put output below this line  
"version": "3.1",
</details>


### Environment information

<details>

Put output below this line


Gradle 6.7.1

Kotlin: 1.3.72 Groovy: 2.5.12 Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020 JVM: 11.0.11 (Oracle Corporation 11.0.11+9-LTS-194)


</details>


### Please include any relevant guides or documentation you're referencing

_No response_

### Describe the bug

The DataStore query doesn't do anything on the first load of the app, so I tried to listen for the DataStoreChannelEventName.READY event, but it took 1 minute from opening the app to when it got into Event Ready.
Is there a way to sync data faster

### Reproduction steps (if applicable)

_No response_

### Code Snippet

```java
// Put your code below this line.

Log output

// Put your logs below this line


amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line


Additional information and screenshots

No response

haitv2910 avatar Nov 25 '21 10:11 haitv2910

When you start datastore sync starts in the background. You can use the observe query API to get the realtime sync results and you will be notified when sync is complete as well.

poojamat avatar Jan 24 '22 22:01 poojamat

The DataStore query doesn't do anything on the first load of the app, so I tried to listen for the DataStoreChannelEventName.READY event, but it took 1 minute from opening the app to when it got into Event Ready. Is there a way to sync data faster

The solution is not working :(. When we use observe query API we got data only after DataStoreChannelEventName.READY event . We got an empty array (initial data) and full array after DataStoreChannelEventName.READY event . Problem is longing time on DataStoreChannelEventName.READY event on the first load of the app.

nazarcybulskij avatar Feb 02 '22 17:02 nazarcybulskij

Is there any data saved locally when the app is started?

poojamat avatar Apr 03 '22 03:04 poojamat

@poojamat I don't save any data when the app is started. It is the first starting app

nazarcybulskij avatar Apr 08 '22 13:04 nazarcybulskij

having the same issue, I resorted to loading static data from a json file. Any solutions?

taouichaimaa avatar Apr 13 '22 10:04 taouichaimaa

A large dataset can cause DataStore sync to take more time to sync all the records and send the READY event. You can limit the number of records being synced using selective syncing.

eeatonaws avatar Apr 13 '22 18:04 eeatonaws

A large dataset can cause DataStore sync to take more time to sync all the records and send the READY event. You can limit the number of records being synced using selective syncing.

my database consists of 20 tables. There is not much data at the moment, about 10 rows in each table. Sync takes more than 30 seconds ((I'm in apathy because I can't solve the problem ((

nazarcybulskij avatar May 19 '22 14:05 nazarcybulskij

@nazarcybulskij Have you got any solution for faster sync ? I have only around 100 data but it takes more than 60 seconds.

maheshordex avatar Jul 05 '22 05:07 maheshordex

@nazarcybulskij In ios with same user takes only 7 seconds it is big diff for sync between android and ios.

maheshordex avatar Jul 05 '22 05:07 maheshordex

#2703 dramatically improved sync times for datastore, bringing it much closer to the iOS time, and was released in Amplify 2.14.10. I'm closing this issue but please feel free to open a new one if necessary.

mattcreaser avatar Feb 13 '24 19:02 mattcreaser

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] avatar Feb 13 '24 19:02 github-actions[bot]