Hi all,
I am just starting out with flexible sync, which works great, but I noticed the sync runtime hours are starting to increase rapidly, for only a couple of syncs I did, even when adding just 2 records on the device and not doing anything else, the sync session seems to remain open. I was wondering whether this is to be expected or whether my set-up is incorrect/suboptimal, I used the initial subscriptions to get all data and used rules to define security so only users’ own records are returned;
<RealmProvider
schema={[ObjectOne, ObjectTwo, ObjectThree, ObjectFour]}
schemaVersion={2}
{... !isAnonUser && {
sync: {
flexible: true,
newRealmFileBehavior: {
type: OpenRealmBehaviorType.DownloadBeforeOpen,
},
existingRealmFileBehavior: {
type: OpenRealmBehaviorType.OpenImmediately,
},
initialSubscriptions: {
update: (mutableSubs, realm) => {
mutableSubs.add(realm.objects(ObjectOne))
mutableSubs.add(realm.objects(ObjectTwo))
mutableSubs.add(realm.objects(ObjectThree))
mutableSubs.add(realm.objects(ObjectFour))
}
},
onError: (e) => {
console.log(e);
}
}
}}
>
{children}
</RealmProvider>
Thanks!