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

Rework server shutdown #4690

Merged
merged 6 commits into from Jan 30, 2021
Merged

Rework server shutdown #4690

merged 6 commits into from Jan 30, 2021

Conversation

rhansen
Copy link
Member

@rhansen rhansen commented Jan 30, 2021

I'm dusting off some old commits I had in the works a while ago:

  • server: Exit on unhandled Promise rejection
  • server: Perform init after adding uncaught exception handler
  • server: Refactor stop() to avoid no-async-promise-executor lint error
  • server: Refine process lifetime management
  • server: Remove all other signal listeners
  • server: Use wtfnode to log reasons why node isn't exiting

I'm hoping this PR will avoid whatever is causing #4684.

This avoids an unnecessary `try` block.
Define states and use them to properly handle multiple calls to
`start()`, `stop()`, and `exit()`. (Multiple calls to `exit()` can
happen if there is an uncaught exception or signal during shutdown.)

This should also make it easier to add support for cleanly restarting
the server after a shutdown (for tests or via an `/admin` page).
@JohnMcLear JohnMcLear merged commit 877f0c5 into develop Jan 30, 2021
@rhansen rhansen deleted the rhansen-shutdown branch February 7, 2021 07:54
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