I have a Sync that syncs the Emloyee local storage to the server.
In the Employee local storage, I have attribute IsSyncing that I tag to True when starting the Sync, to make sure I don't have duplicate records(due to sync being called several times and having slow network) I only call the records with IsSyncing to False.
The process is:
The issue is let's say the ongoing sync is on Step 3 and I close/kill the app, the IsSyncing will remain to True even though it is not synced yet to the server, in result it will basically be a bad data since I won't be able to sync it again because I'm only getting IsSyncing = False when calling the Sync process.
The reason I update the IsSyncing to True (Step 2) before the Sync process (Step 3) is because Step 3 takes some time to finish; and if two Sync is called at the same time, they will get the same records and will result to duplicate records to the server.
Any idea how do I solve this? Or maybe there is a better approach to handle this scenario? Thank you!
Hello @Kenneth1 , below is a documentation of the recommended patterns by Outsystems for Offline Sync.https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Offline/Implementing_Offline_Sync
You may use it as a baseline and customize it at a later end that best fits your business requirement.
Hope this helps,
Kind regards,
Hello @Kenneth1 ,
Check out this here this is explained in Course available for Synchronization
https://www.outsystems.com/training/courses/170/data-synchronization/
Check Out These Forge Components Where Sync patterns are define , You can check and demonstrate
https://www.outsystems.com/forge/component-overview/1638/offline-data-sync-patterns
Also you can check them if it helps
Training for advanced Read/Write synchronization patterns.
Hope it helps
Thanks