The following code is generating about 30 some odd connections on the Primary MongoDB instance. How does the deviceSync subscription and mongoDB instance connection correlate?
1 subscribe = ~30 connections?
let fetchResult = try? await syncedRealm
.objects(SUPER_COOOL_TYPE.self)
.where({ $0.value == value })
.subscribe(waitForSync: .always)
guard let result = fetchResult else {
return
}
try? await syncedRealm.asyncWrite({
// do some work
switch (input, output) {
case (.some, .some(let outValue)):
syncedRealm.add(outValue)
case (.some(let inValue), .none):
syncedRealm.delete(inValue)
default:
break
}
})
result.unsubscribe()