-
Notifications
You must be signed in to change notification settings - Fork 96
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
Let Client.attach
wait until stream initialization is finished
#440
Conversation
Codecov Report
@@ Coverage Diff @@
## main #440 +/- ##
==========================================
- Coverage 89.51% 89.37% -0.14%
==========================================
Files 69 69
Lines 5321 5289 -32
Branches 524 524
==========================================
- Hits 4763 4727 -36
- Misses 381 385 +4
Partials 177 177
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
Thanks for your contribution. I have a few questions.
Do we need to add await this.runWatchLoop()
on client.detach
and client.activate
as well?
I missed |
`Client.attach` can be terminated before getting peer presence map in `WatchDocuments` stream initialization. It can cause presence missing when `updatePresence` is called before the initialization.
7659e31
to
8d1720a
Compare
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.
Thanks for your contribution.
`Client.attach` can be terminated before getting peer presence map in `WatchDocuments` stream initialization. It can cause presence missing when `updatePresence` is called before the initialization.
…kie-team#440) `Client.attach` can be terminated before getting peer presence map in `WatchDocuments` stream initialization. It can cause presence missing when `updatePresence` is called before the initialization.
What this PR does / why we need it?
Client.attach
can be terminated before getting peer presence map inWatchDocuments
stream initialization. It can cause presence missing, which breaks eventual consistency, whenupdatePresence
is called before the initialization.This PR made
Client.attach
wait until the initialization is finished. Presence updates will be executed after peer presence map is properly set.Any background context you want to provide?
If
delay()
is removed in the code below, test in the last line intermittently fails.yorkie-js-sdk/test/integration/client_test.ts
Lines 291 to 309 in 717383d
It means the eventual values of
c1.getPeers()
andc2.getPeers()
become different. To be precise,c1
's presence inc2.getPeers()
is not updated. Although these two clients are attached to the same document, the stream initialization timing issue (mentioned above) breaks eventual consistency.What are the relevant tickets?
Fixes #428
Checklist