Merge branch 'dev-lwl/consul' into test
This commit is contained in:
commit
53a7521996
|
@ -41,12 +41,17 @@ func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip strin
|
||||||
|
|
||||||
done := make(chan int)
|
done := make(chan int)
|
||||||
go func() {
|
go func() {
|
||||||
quit := make(chan os.Signal)
|
quit := make(chan os.Signal, 1)
|
||||||
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-quit:
|
case <-quit:
|
||||||
logger.Info("Shutdown Server ...")
|
logger.Info("Shutdown Server ...")
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
logger.Info("__Shutdown sleep %v", i+1)
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
}
|
||||||
|
|
||||||
if err := servicediscovery.DeRegister(ip, port); err != nil {
|
if err := servicediscovery.DeRegister(ip, port); err != nil {
|
||||||
logger.Fatal("DeRegister fail: %v", err)
|
logger.Fatal("DeRegister fail: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue