register fix
This commit is contained in:
parent
bc27da0be3
commit
d99436d2d6
@ -2,7 +2,6 @@ package consul
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
@ -115,13 +114,15 @@ func (s *Service) healthCheck() (bool, error) {
|
|||||||
|
|
||||||
if alive {
|
if alive {
|
||||||
if err := s.ConsulAgent.PassTTL("service:"+s.GetID(), "OK"); err != nil {
|
if err := s.ConsulAgent.PassTTL("service:"+s.GetID(), "OK"); err != nil {
|
||||||
log.Println("health-check pass err:" + err.Error())
|
return false, err
|
||||||
|
// log.Println("health-check pass err:" + err.Error())
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.ConsulAgent.FailTTL("service:"+s.GetID(), ErrServiceUnavailable.Error()); err != nil {
|
if err := s.ConsulAgent.FailTTL("service:"+s.GetID(), ErrServiceUnavailable.Error()); err != nil {
|
||||||
log.Println("health-check fail err:" + err.Error())
|
return false, err
|
||||||
|
// log.Println("health-check fail err:" + err.Error())
|
||||||
}
|
}
|
||||||
return false, ErrServiceUnavailable
|
return false, ErrServiceUnavailable
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user