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

Initial implementation for a graceful shutdown of the watchdog. #587

Closed
wants to merge 1 commit into from
Closed

Initial implementation for a graceful shutdown of the watchdog. #587

wants to merge 1 commit into from

Conversation

Templum
Copy link
Contributor

@Templum Templum commented Mar 19, 2018

As discussed in #573 currently the watchdog does not react upon receiving a SIGTERM. I used the new functionality of the HTTP server to perform a graceful shutdown once a SIGTERM was received. As windows container are more rarely it currently only supports Linux container.

Description

I created a new function named gracefulShutdown which expects a pointer to an http server which will be used to perform the shutdown invocation. Further for testing purposes it also accepts a bool channel. However, I'm not quite happy with that trick, so if someone knows a better approach I'm happy to learn.

Motivation and Context

How Has This Been Tested?

I created a simple test case which uses an HTTP Server to check if a received SIGTERM leads to a shutdown invocation on the HTTP Server.

Types of changes

  • Bug fix (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 change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@alexellis
Copy link
Member

Hi Simon, in the referenced issue (#573) I asked for us to use the idomatic Golang approach of cancel with the HTTP server implementation.

I've raised a PR that makes use of the pattern from the Golang documentation and have tested it inside Docker Swarm and Kubernetes. Please test it and report back if you have any feedback.

@Templum
Copy link
Contributor Author

Templum commented Mar 20, 2018

Hi Alex,

as you pointed towards the usage of the HTTP server, I also implemented it. Overall our implementations are kind if similar with some minor differences, for example, you used a flag and used it within the health check. I, on the other hand, used another sort of context avoiding the extra timer. Can you describe me how you tested it? So I can test it in the same way.

@Templum Templum closed this Mar 23, 2018
@Templum Templum deleted the Issue-#573 branch March 23, 2018 20:56
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.

2 participants