From 66ef76ce6dcff0441a08f0703755588207e45679 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Fri, 1 May 2020 03:06:45 +0300 Subject: [PATCH] Handle SIGTERM as a valid stop signal for a graceful shutdown since it's the default stop code for the Docker --- CHANGELOG.md | 1 + http/http.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52047b8..8a30653 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Handle the case when there is no textures property in Mojang's response. +- Handle `SIGTERM` as a valid stop signal for a graceful shutdown since it's the default stop code for the Docker. ### Changed - `ely.skinsystem.{hostname}.app.mojang_textures.usernames.round_time` timer will not be recorded if the iteration was diff --git a/http/http.go b/http/http.go index 353eca1..38620cd 100644 --- a/http/http.go +++ b/http/http.go @@ -7,6 +7,7 @@ import ( "os" "os/signal" "strings" + "syscall" "github.com/gorilla/mux" "github.com/mono83/slf" @@ -45,7 +46,7 @@ func StartServer(server *http.Server, logger slf.Logger) { func waitForExitSignal() os.Signal { ch := make(chan os.Signal, 1) - signal.Notify(ch, os.Interrupt, os.Kill) + signal.Notify(ch, os.Interrupt, syscall.SIGTERM, os.Kill) return <-ch }