healthcheck 수정

This commit is contained in:
2023-07-10 17:53:23 +09:00
parent b759f13eee
commit 38683eb616

View File

@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"math"
"net"
"net/http"
"net/url"
@ -129,10 +130,16 @@ func (server *Server) shutdown() {
if t := atomic.LoadInt64(&healthcheckcounter); t > 0 {
logger.Println("http server shutdown. healthcheckcounter :", t)
atomic.StoreInt64(&healthcheckcounter, 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)
for cnt := 0; cnt >= 100; {
next := atomic.LoadInt64(&healthcheckcounter)
if next == t {
cnt++
} else {
t = next
cnt = 0
}
time.Sleep(100 * time.Millisecond)
}
logger.Println("http server shutdown. healthcheck completed")