-
Notifications
You must be signed in to change notification settings - Fork 782
Replaces monarchy.doWithRealm with monarchy.awaitTransaction #5792
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
Conversation
@@ -93,7 +93,7 @@ internal class SyncResponsePostTreatmentAggregatorHandler @Inject constructor( | |||
|
|||
private fun List<User>.saveLocally() { | |||
val userEntities = map { user -> UserEntityFactory.create(user) } | |||
monarchy.doWithRealm { | |||
monarchy.writeAsync { |
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.
should this be awaitTransaction
to force the suspend flow to be synchronous?
I'm wondering if logic further down the flow is expecting these database values to be set
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.
We should have completed this before the next sync yeah
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.
(even if technically we can only have one transaction at a time)
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.
LGTM
Type of change
Content
Replaces monarchy.doWithRealm with monarchy.awaitTransaction
Motivation and context
This fixes a bug that was crashing the whole sync
Screenshots / GIFs
Tests
Test that #5618 still works and no errors are thrown as a result of the sync
Tested devices
Checklist