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

Refactored socket connection #73

Merged
merged 14 commits into from
May 16, 2023
Merged

Refactored socket connection #73

merged 14 commits into from
May 16, 2023

Conversation

johncalesp
Copy link
Contributor

  • Refactored connection between deepview explore and profile
  • Now, only 1 port will be open during the profiling session
  • Connection request will be sent when react-ui renders and use-effect is triggered

@johncalesp johncalesp requested review from michaelshin and jimgao1 May 15, 2023 20:14
@michaelshin
Copy link
Contributor

I would modify the description of this PR. It doesn't seem like DeepView is forcing only one port to be used, but it is just refactored to be a bit more robust

@@ -142,17 +142,18 @@ export class SkylineSession {
}

connect() {
this.connection.connect(this.port, this.addr, this.on_open.bind(this));
this.connection.connect(this.port, this.addr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way for the connection status to update if the frontend reconnects? I think the callback function is need to make sure the frontend can reconnect. In this case, the callback should be this.on_connect instead of this,open

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a video to explain better the current situation and the proposed change.
https://drive.google.com/file/d/19cypooi60meDisYFNLh047a5oc3IZ3MI/view?usp=sharing
and this is a link that can be of help https://stackoverflow.com/questions/25791436/reconnect-net-socket-nodejs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! To summarize, the listener is still active so when a connection is reset, we have multiple connections trying to reconnect when it should actually just be one. This creates possible race conditions and weird behaviour in the frontend

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah!, additionally, its better to start the connection when the react-ui renders instead of vs-code plugin so it doesn't show an error in the first render

@codeclimate
Copy link

codeclimate bot commented May 16, 2023

Code Climate has analyzed commit 80ec0b8 and detected 0 issues on this pull request.

View more on Code Climate.

@johncalesp johncalesp requested a review from michaelshin May 16, 2023 14:22
@johncalesp johncalesp merged commit 3e133e0 into main May 16, 2023
@johncalesp johncalesp deleted the ssh-connection branch May 16, 2023 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants