-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for compensating writes #5599
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few comments and suggestions.
Co-authored-by: Kræn Hansen <[email protected]>
Co-authored-by: Kræn Hansen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a couple of suggestions, and they shouldn't block you in any way. Great to see compensating writes coming to a SDK near me 😄
Co-authored-by: Kenneth Geisshirt <[email protected]>
* main: Add steps for prerequisites for running MDB aggregation tests. (#5475) Remove dependencies.list (#5598) Removed dependency on bare "mocha-remote" package. Making prebuild-install --verbose Bundle on CI (#5570) Fix example (#5534) Import device-info platform module to React Native bundle (#5594) Chang order of PATH segments, fixing the BaaS test server Download the assisted_agg binary (#5592)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great and thanks 🙏 Added suggestions 👍
Co-authored-by: LJ <[email protected]>
Co-authored-by: LJ <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a problem with this PR, but it looks like we don't expose the log url in the sync error. We should probably do it as the server logs are quite useful to understand what exactly is failing.
realm.create<IDog>(DogSchema.name, { _id: new BSON.ObjectId(), name: "Oldy", age: 6, owner: luigi }); | ||
}); | ||
|
||
await realm?.syncSession?.uploadAllLocalChanges(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?all?these?question?marks? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're fun to use 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it should only be needed after syncSession
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional chaining! It replaces this code:
if( realm && realm.syncSession && realm.syncSession.uploadAllLocalChanges){
await realm.syncSession.uploadAllLocalChanges();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But maybe we don't even need them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just the second one, I think it's fine :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need either one. If the syncSession
is undefined/null, I'd rather that this throws than silently does nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript will be defensive about this and have a type error if you do not have a check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, why is Realm.syncSession
nullable but Realm.subscriptions
not? In any case, this should use !
then to express that we know this is not null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess is that subscriptions
can just return an empty array, even if sync isn't enabled. syncSession
should return null if sync isn't configured
* main: Prepare for vNext Fixed extraction of version in publish workflow Prepare for 12.0.0-alpha.0 (#5600) Remove redundant MongoDBCollection watch tests. # Conflicts: # CHANGELOG.md
@elle-j @kraenhansen @takameyer @kneth
|
ShipIt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's just one thing missing 😬
This PR adds a new error class for compensating writes errors.
☑️ ToDos