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

Adds SIGTERM listener to gracefully shutdown the server #269

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

HarryEMartland
Copy link

Kubernetes and other process managers send a SIGTERM to applications to give them time to shut down. This change adds a listener to this event which shuts the server down gracefully.

@HarryEMartland
Copy link
Author

@dougwilson sorry I must have missed a notification adding the tags. When you say needs tests what kind of tests would you be looking for? Thanks

Copy link
Member

@UlisesGascon UlisesGascon left a comment

Choose a reason for hiding this comment

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

Change in 0db2765 seems to fix backward compatibility. Not very sure if @dougwilson want to implement extra test for SIGTERM case 🤔

Great idea @HarryEMartland

@UlisesGascon
Copy link
Member

maybe @dougwilson can re-run the tests for Job #792.3. Seems like there was a error on node-sass building process (not relevant to the PR change) Direct Link

Copy link
Contributor

@dougwilson dougwilson left a comment

Choose a reason for hiding this comment

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

Yes, we need to add tests to test suite when new feature added or bug fixed.

@HarryEMartland
Copy link
Author

If someone could give me some pointers on how to test this I would greatly appreciate it. The issue is only really noticeable if a request takes a decent amount of time.

In sudo code I would want to test something like this;

Start app
Make a request to a slow endpoint
Send SIGTERM to process
Wait for the request to finish
Verify the request returned successfully
Verify the process exited

I have had a play with the existing tests and can see that there is code already sending SIGTERM. I am however unsure of how to add a new endpoint with a delay in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants