aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.32k stars 248 forks source link

DataStore sync on Android physical devices takes very long time #4678

Closed szymondobrzanski closed 6 months ago

szymondobrzanski commented 7 months ago

Description

Greetings,

I've observed that syncing DataStore on Android physical devices running Android version 10 or higher is time-consuming, typically ranging from 20 seconds to 2 minutes. On devices with older Android versions (specifically tested with 7 and 8), the sync process is notably swifter, max 15 seconds. I haven't been able to replicate this issue on emulators. Comparatively, on iOS devices, the sync completes within a matter of seconds.

Upon initializing the app, I trigger the sync process to load all necessary data:

await Amplify.DataStore.start();
await Amplify.Hub.availableStreams[HubChannel.DataStore]!
        .firstWhere((event) => event.eventName == "ready");

Numerous Android users of my app have reported encountering the same issue. For now the only workaround I see is dropping DataStore and replacing it with API-based approach. However, this would force me to rewrite my application's infrastructure layer. While I've come across similar reported issues, they appear to have been closed without a definitive solution or explanation for the underlying cause.

Categories

Steps to Reproduce

Reproduce steps similar to case in my application:

  1. Add 20+ models to schema.graphql
  2. Populate them with data
  3. Build app on android physical device with android version 10+
  4. Register user
  5. Start sync
  6. Wait until sync finishes

Screenshots

No response

Platforms

Flutter Version

3.19.5

Amplify Flutter Version

1.7.0

Deployment Method

Amplify CLI

Schema

No response

Equartey commented 7 months ago

Hi @szymondobrzanski, sorry you've ran into this issue. This is a known issue that we're working to resolve. We'll update you when we've released a fix.

szymondobrzanski commented 7 months ago

Hey @Equartey @khatruong2009, do you have an ETA for this fix?

Equartey commented 7 months ago

@szymondobrzanski we do not have a concrete timeline, but I can assure you this is one of our top priorities.

We have an open PR #4279 that should resolve this issue.

We'll provide an update when its available.

amitchaudhary140 commented 7 months ago

Yes this is much needed because my Android users are complaining a lot. Good to know that it is your top priority and we expect the fix to be launched soon. @Equartey Could you please confirm this fix might work for React Native Expo projects as well? Or is it just Flutter?

Equartey commented 7 months ago

Hi @amitchaudhary140, our fix will only be for Amplify Flutter. If you are observing similar issues with an Amplify React Native project, please submit a issue to their repo: https://github.com/aws-amplify/amplify-js/issues/new/choose

tanle17th commented 6 months ago

Hi @Equartey, do you guys have a plan for shipping https://github.com/aws-amplify/amplify-flutter/pull/4279?

NikaHsn commented 6 months ago

Thank you for your patience. The issue has been fixed in version 1.8.0. and I'm closing it. However, if you encounter any issues after updating to version 1.8.0, please don't hesitate to reopen it.