-
Notifications
You must be signed in to change notification settings - Fork 5
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
Implement pause and resume #90
Conversation
require(isActive) { | ||
"client is not active" | ||
} | ||
attachments.value[document.key]?.isRealTimeSync = isRealTimeSync |
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.
if it would be better to throw exceptions for non-existing keys, I'll fix it.
@@ -4,7 +4,7 @@ import dev.yorkie.document.Document | |||
|
|||
internal data class Attachment( | |||
val document: Document, | |||
val isRealTimeSync: Boolean, | |||
var isRealTimeSync: Boolean, |
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.
having mutable properties for a state could be dangerous, as value changes in such properties do not emit changes to subscirbers, and isRealTimeSync
is used in a Flow.map
.
we should keep it immutable and always create a new instance of an Attachment when there are changes.
this is why I changed peerPresences to a immutable map in previous work.
remoteChangeEventReceived
is a special case, since it is only used inside a while loop, and changes do not need emissions. but it would be better to make it immutable.
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.
thank you for explaining it in detail.
I made isRealTimeSync
and remoteChangeEventReceived
immutable: 56aa510
Codecov Report
@@ Coverage Diff @@
## main #90 +/- ##
==========================================
- Coverage 81.93% 81.63% -0.30%
==========================================
Files 52 52
Lines 2397 2407 +10
Branches 335 335
==========================================
+ Hits 1964 1965 +1
- Misses 252 261 +9
Partials 181 181
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
What this PR does / why we need it?
Any background context you want to provide?
implemented based on the iOS SDK implementation.
What are the relevant tickets?
Fixes #
Checklist