Skip to content
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

[realtime] Multiple websocket are open #143

Closed
gregorylegarec opened this issue Nov 27, 2018 · 1 comment
Closed

[realtime] Multiple websocket are open #143

gregorylegarec opened this issue Nov 27, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@gregorylegarec
Copy link
Contributor

Cozy-Realtime open several sockets to the stack instead of only one.

This is due to race condition located in getCozySocket. If several calls to realtime.subscribe or subscribeAll are made in a row, each will generate a new call to getCozySocket. But as getCozySocket is asynchronous, the socket singleton will not be return and a new condition will be made.

Instead of the cozySocket, we should return here the promise of the cozySocket.

This fix need tests.

@gregorylegarec gregorylegarec added the bug Something isn't working label Nov 27, 2018
@gregorylegarec
Copy link
Contributor Author

Thanks @nono for spotting this race condition 👍

CPatchane added a commit to CPatchane/cozy-libs that referenced this issue Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant