Skip to content

fix(ignitor signalslistener): always listen for SIGINT #1215

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

Closed
wants to merge 1 commit into from

Conversation

McSneaky
Copy link
Contributor

@McSneaky McSneaky commented Mar 7, 2020

Proposed changes

This PR will make Ignitor to always listen for SIGINT so server is killable in containers.
Also ads Shutting down server... message when shutdown process is started

Fixes: adonisjs-community/create-adonis-ts-app#5

Types of changes

What types of changes does your code introduce?

Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have read the CONTRIBUTING doc
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

Further comments

This is how killing server looks after change:
From left:
CTRL + C while attached to container
CTRL + C while running server in bash
SIGTERM from another bash
image

Before change:
image
Only way to kill container is open another bash instance and do docker kill CONTAINER_ID

This commit will make Ignitor to always listen for SIGINT so server is killable in containers.

adonisjs-community/create-adonis-ts-app#5
Copy link
Member

@thetutlage thetutlage left a comment

Choose a reason for hiding this comment

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

Lemme search a bit on this topic, before merging this

@@ -19,6 +19,7 @@ export class SignalsListener {
*/
private kill = async function () {
try {
console.log('Shutting down server...')
Copy link
Member

Choose a reason for hiding this comment

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

Modules should never have hardcoded console statements

Copy link
Contributor Author

@McSneaky McSneaky Mar 8, 2020

Choose a reason for hiding this comment

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

Hmm, should use debug or logger module instead?

@thetutlage
Copy link
Member

@McSneaky Maybe we both can collaborate on this and see what's the best way to improve the behavior. For now, I am closing the PR as part of housekeeping

@thetutlage thetutlage closed this Jul 26, 2020
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.

Server refuses to die in container
3 participants