fix: close ngrok session in disconnect function #163
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The disconnect function was only removing the session from the mutex without properly closing it when calling
ngrok.killorngrok.disconnect. This change ensures the session's close() method is called before removing it, which properly shuts down the ngrok session/agent.Starting a tunnel and running

await ngrok.kill():Then running

ngrok http 80in another terminal:Attempting to run the script while the CLI agent is running (as a test that I do indeed get this when >1 agent runs):

Note: While this does fix #148 the session still can take up to 1-3 seconds to close. Mileage may vary.
fixes #148
Note: The smoke test pass, I could not run the full suite so need to test this on my other machine. Additionally, it was not clear whether I should commit the index file generated by the build process or let the workflow do this. On my machine I could only run the debug build process so I did not commit those files.