You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on an offline-first app. Periodically, we trigger a synchronization process with an API, pulling data from 4 different endpoints, with pagination (so often multiple requests). Data are linked (by foreign keys) between these 4 endpoints. So we execute all requests, keep all data (in files currently) and perform save process after that, in a single Realm write transaction. It works but using files to keep data is far from optimal (it implies multiple JSON encoding/decoding of the same data).
I'm looking for improving this process. I could keep all data in memory and perform saving at the end, but there could be a lot of data so I consider this as risky.
Another way would be to manage a Realm transaction manually (by calling begin/commit) and wrap all requests and save data progressively. My main concerns are threading and transaction lifecycle. Is an actor isolated Realm a good solution for this use case?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm working on an offline-first app. Periodically, we trigger a synchronization process with an API, pulling data from 4 different endpoints, with pagination (so often multiple requests). Data are linked (by foreign keys) between these 4 endpoints. So we execute all requests, keep all data (in files currently) and perform save process after that, in a single Realm write transaction. It works but using files to keep data is far from optimal (it implies multiple JSON encoding/decoding of the same data).
I'm looking for improving this process. I could keep all data in memory and perform saving at the end, but there could be a lot of data so I consider this as risky.
Another way would be to manage a Realm transaction manually (by calling begin/commit) and wrap all requests and save data progressively. My main concerns are threading and transaction lifecycle. Is an actor isolated Realm a good solution for this use case?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions