diff --git a/server.go b/server.go index 27c5da9..8560463 100644 --- a/server.go +++ b/server.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "io" - "math" "net" "net/http" "net/url" @@ -75,8 +74,6 @@ func healthCheckHandler(w http.ResponseWriter, r *http.Request) { if t := atomic.AddInt64(&healthcheckcounter, 1); t < 0 { logger.Println("healthCheckHandler return StatusServiceUnavailable :", t) w.WriteHeader(http.StatusServiceUnavailable) - } else { - logger.Println("healthCheckHandler return StatusOK :", t) } } @@ -133,10 +130,9 @@ func (server *Server) shutdown() { if t := atomic.LoadInt64(&healthcheckcounter); t > 0 { logger.Println("http server shutdown. healthcheckcounter :", t) - t = math.MinInt64 - atomic.StoreInt64(&healthcheckcounter, t) - for ; t-math.MinInt64 > 0; t = atomic.LoadInt64(&healthcheckcounter) { - logger.Println(" waiting for healthcheckcounter increase y lb", t-math.MinInt64) + atomic.StoreInt64(&healthcheckcounter, -100000000) + for t = -100000000; t+100000000 < 10; t = atomic.LoadInt64(&healthcheckcounter) { + logger.Println(" waiting for healthcheckcounter increase y lb", t+100000000) time.Sleep(100 * time.Millisecond) } logger.Println("http server shutdown. healthcheck completed")