healthcheck 수정
This commit is contained in:
13
server.go
13
server.go
@ -6,6 +6,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"math"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -129,10 +130,16 @@ func (server *Server) shutdown() {
|
|||||||
|
|
||||||
if t := atomic.LoadInt64(&healthcheckcounter); t > 0 {
|
if t := atomic.LoadInt64(&healthcheckcounter); t > 0 {
|
||||||
logger.Println("http server shutdown. healthcheckcounter :", t)
|
logger.Println("http server shutdown. healthcheckcounter :", t)
|
||||||
|
atomic.StoreInt64(&healthcheckcounter, math.MinInt64)
|
||||||
|
|
||||||
atomic.StoreInt64(&healthcheckcounter, -100000000)
|
for cnt := 0; cnt >= 100; {
|
||||||
for t = -100000000; t+100000000 < 10; t = atomic.LoadInt64(&healthcheckcounter) {
|
next := atomic.LoadInt64(&healthcheckcounter)
|
||||||
logger.Println(" waiting for healthcheckcounter increase y lb", t+100000000)
|
if next == t {
|
||||||
|
cnt++
|
||||||
|
} else {
|
||||||
|
t = next
|
||||||
|
cnt = 0
|
||||||
|
}
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
}
|
}
|
||||||
logger.Println("http server shutdown. healthcheck completed")
|
logger.Println("http server shutdown. healthcheck completed")
|
||||||
|
|||||||
Reference in New Issue
Block a user