Skip to content

Gracefully shutdown http server #46

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adrienkohlbecker
Copy link

Hello,

I’ve noticed that the process always exits with a non-zero code because of the use of log.Fatal. In my installation, it causes systemd to believe that the process failed even during routine restarts, which triggers alerts in my monitoring.

Using the code from https://dev.to/mokiat/proper-http-shutdown-in-go-3fji, I’ve implemented a graceful shutdown mechanism for the HTTP server when SIGTERM or SIGINT signals are received, ensuring a zero exit code.

Let me know what you think!

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.

1 participant