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

DataStore: support pausing/resuming of cloud sync

Open nylki opened this issue 6 years ago • 13 comments

Is your feature request related to a problem? Please describe. If I understand correctly, the DataStore currently always syncs updates immediately to the cloud. This may not be desirable for battery conservation and data usage. We have fullSyncInterval but DataStore will still sync updates in between full syncs.

Describe the solution you'd like I would like the DataStore-API to support a manual cloud-sync functionality, so that the App could for example sync only a few times a day eg. when the device is connected to power.

eg.:

DataStore.configure({
   manualSync: true
})

DataStore.sync()

or, alternatively, when auto-syncing an option to pause auto-syncing:

// When power is low
DataStore.pauseAutoSync()

// user has plugged in power
DataStore.resumeAutoSync()

Describe alternatives you've considered

Not using DataStore, but fetching/sending data via regular graphQL-API and store the Data manually in a storage-api (localstorage, indexedDB and or React-Native's AsyncStorage). This would complicate things, due to mapping different graphQL datatypes to the storage-api, something that DataStore already does.

Additional context If this should be already possible in some way, the documentation should be edited to include the feature.

nylki avatar Mar 04 '20 13:03 nylki

I need this feature too. Use case:

I am working on an app in which people might be in remote locations (in the jungle, top of a mountain etc.). In the app users have to be able to set if they only want to sync if they are for example on a WiFi network to prevent data charges.

mdoesburg avatar Jun 08 '20 12:06 mdoesburg

I need this feature too¡¡¡ Use Case: I am working in an app that have a free function with Datastore locally, and a pay function with cloud storage, and this feature proposed by @nylki is so useful for me.

iqaldebaran avatar Aug 25 '20 01:08 iqaldebaran

I would also love this feature. Both for a free vs paid user scenario, and also to have control over the number of writes to AppSync. In my use case, users edit only their own data, and only view data from other users. This data needs to be updated in the cloud only once per day, but will be entered locally several times a day. It would be nice to save to the cloud once per session, or only once per day.

JPVan avatar Sep 08 '20 13:09 JPVan

Please add this!

imoby avatar Oct 31 '20 18:10 imoby

+1

jtich avatar Nov 04 '20 22:11 jtich

Bumping this - it's needed badly.

I've got a pre-sign-up flow where users create a bunch of data, which saves locally on a User object without an ID. When signing up, this is copied as a real User object with a UUID, and deleting the placeholder, but sometimes the placeholder syncs to DynamoDB too...

jacobsapps avatar Jan 19 '21 12:01 jacobsapps

+1

sasweb avatar Feb 02 '21 08:02 sasweb

+1

fizan2904 avatar Apr 18 '21 19:04 fizan2904

+1

sallymoon10 avatar Apr 24 '21 00:04 sallymoon10

Hello is the feature now available ?

nemezisSherokee avatar May 24 '21 12:05 nemezisSherokee

Our use case is for highly intermittent networks - if its on/off/on/off/on.... then the sync is trying to restart over and over again and consumes essentially all of the phone's resources. This leads the app to hang for several minutes and in some cases eventually crash. Our customers are in very remote places that have highly intermittent networks. They are industrial sites that have some network access, but it varies as they walk around the site.

We need to be able to tell DataStore not to try to sync - alternatively, but be able to have it as a lower priority background process that does not overwhelm the application.

sacrampton avatar Mar 03 '22 05:03 sacrampton

Hi all,

I'm Emily, a UX Designer on the AWS Amplify team, and we're conducting user interviews to learn more about the use cases of offline-first vs online-only development modes. The interview will be take at most 30 minutes, and as a “thank you”, we’d love to provide you with $25 in AWS credits for your time.

If you are interested in participating, please email me at [email protected] and we can schedule a time. Thanks!

emilyahsu avatar Jun 22 '22 16:06 emilyahsu

Is there any update regarding this feature?

jreyesgfi avatar Jul 29 '24 09:07 jreyesgfi

Please remove Stephen Crampton from your mailing list, He passed away this year & I (his wife Megan's) don't have access to his passwords on this platform/website,

Kind regards

Megan

On Mon, 29 July 2024, 7:35 pm jreyesgfi, @.***> wrote:

Is there any update regarding this feature?

— Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-js/issues/5037#issuecomment-2255455379, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQROCBW6FYPXWZDFOQHARDZOYEEXAVCNFSM6AAAAABLT4NE6WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJVGQ2TKMZXHE . You are receiving this because you commented.Message ID: @.***>

sacrampton avatar Sep 01 '24 11:09 sacrampton