Improve OfflineDataSync - allow for concurrent requests
211
Views
8
Comments
New
Mobile

Let's say that I want to sync Tickets, Ticket Types, Users and Queues. Tickets and Ticket Types are connected, so I want to join them in a first sync. Users and Queues are related, so I want to join them in a second sync. But, I want both syncs to start at the same time, so that I cut in half the processing time.

Right now, even though the description of the TriggerOfflineDataSync action clearly states "Action where you can invoke OfflineDataSync asynchronously", the syncs run one after the other, as you can see in the browser network tab.

Some of the syncs rely on endpoints that could take some time to respond, so not doing this concurrently makes our apps feel slow. Users will have to wait extra time to have data available to start working.


Note: this was originally posted as a Support Case but I was told to add it as an idea here

Hi Tiago,

Where do you want to trigger the data sync? You can use the technique described in this article if it's from a screen.


Regards.

Hi @Ricardo Reis! Data actions are not really meant to sync data. As they can only be used in the context of a screen or block, if the user navigates away before the data is fetched, nothing will be synced.

On the other hand, OfflineDataSync is meant for sync use cases and works in the background. Furthermore, if there is a sync framework in OutSystems I don't think such a basic use case as doing multiple sync concurrently should need workarounds.

Let me know what you think ;)

Tiago,

Although that article uses data actions as an example, the technique works with any server-side logic. What I mean is that calling another client action via JavaScript will create another processing thread (the one where the server-side logic is called).

From there, you can trigger your asynchronous data sync, which can run regardless of the user staying on the screen.

Nevertheless, I agree with you that the out-of-the-box solution OutSystems provides could be improved without these workarounds. 

Yes, while it's technically possible by calling server actions, we lose the ability to natively configure the flags "SyncOnOnline", "SyncOnResume", "RetryOnError", etc. We also lose the tracking of the "OnSyncComplete", "OnSyncError" events triggered by the OfflineDataSyncEvents block.

Most importantly, a lot of developers won't even notice that calling TriggerOfflineDataSync blocks the flow as the description clearly states "Action where you can invoke OfflineDataSync asynchronously".

2025-05-31 09-56-11
TheSubuIyer
Champion

This is indeed a good idea and will help with the first experience of the app or sync.

Many time we need to sync Mutiple tables and the users is waiting or the same making the experience poor.

Having the abiity to natively configure the flags "SyncOnOnline", "SyncOnResume", "RetryOnError", etc will help.

This is definitely a valuable improvement and would enhance the initial experience when using the app or performing a sync. 

This is a great idea that would improve the first-time app or sync experience, especially when syncing multiple tables, and having native options like "SyncOnOnline", "SyncOnResume", and "RetryOnError" would make it easier to manage.