Hello everyone, I am new to using Mongodb and Atlas. I am using the Realm Flutter SDK and Flexible Device Sync for my app.
I have a problem where the wait for synchronization takes up to 6 minutes to complete before any data shows on my app. I don’t believe that is normal.
After authentication and opening the realm, and creating subscription for collections I want to write to, which happens really fast, the wait for sync take 2-7 minutes to complete. Here are sample code:
Future openRealm() async {
var connected = await hasConnection();
if (connected) {
try {
//Open the realm using the user credentials and schema configurations
realm = await Realm.open(
realmConfig,
);
//create or update the subscription for collections that will be written to
realm.subscriptions.update((mutableSubscriptions) {
mutableSubscriptions.add(
realm.query<Product>('userId == \$0', [login.userId]),
name: 'ProductSubscription',
update: true);
// other collections...
});
await realm.subscriptions.waitForSynchronization();
await realm.syncSession.waitForDownload();
} catch (e) {
print('$e');
}
} else {
realm = Realm(realmConfig);
}
}
I have tried to use either wait for sync or wait for download instead of both to see if it reduces the time but it’s the same thing.
Please any suggestions or advice to reduce the time it takes?