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

[dap] improve dap startup and shutdown #914

Merged
merged 6 commits into from
Feb 20, 2021

Conversation

TheGeorge
Copy link
Contributor

@TheGeorge TheGeorge commented Feb 16, 2021

  • shutdown dap and send events when project node goes down
  • ensure, that we don't double monitor nodes
  • shutdown project node when we get a disconnect request
  • add config for cookie and startup timeout

@TheGeorge
Copy link
Contributor Author

it made sense to merge #915 and this one into one PR.

@TheGeorge TheGeorge changed the title [dap] add option to configure cookie of the project node [dap] improve dap startup and shutdown Feb 17, 2021
@TheGeorge
Copy link
Contributor Author

@robertoaloi can you take a look?

% connect and monitore project node
case els_distribution_server:wait_connect_and_monitor(Node, Timeout) of
ok -> inject_dap_agent(Node);
_ -> stop_debugger()
Copy link
Member

Choose a reason for hiding this comment

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

This could be just error, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case we could crash, and let the supervisor handle the error behavior.

timer:sleep(?WAIT_INTERVAL),
case connect_and_monitor(Node) of
ok ->
ok;
error ->
?LOG_WARNING( "Trying to connect to node ~p (~p/~p)"
, [Node, ?WAIT_ATTEMPTS - Attempts + 1, ?WAIT_ATTEMPTS]),
wait_connect_and_monitor(Node, Attempts - 1)
, [Node, MaxAttempts - Attempts + 1, MaxAttempts]),
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, why do we need this change?

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 added a config parameter, that makes the connection timeout configurable. This change displays the connection attemps correctly (e.g. 12/30)

% connect and monitore project node
case els_distribution_server:wait_connect_and_monitor(Node, Timeout) of
ok -> inject_dap_agent(Node);
_ -> stop_debugger()
Copy link
Member

Choose a reason for hiding this comment

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

This could just be error, right?

@robertoaloi robertoaloi merged commit 2f95b2a into erlang-ls:main Feb 20, 2021
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.

None yet

2 participants