Consul update ttl fix

This commit is contained in:
Piotr Biernat 2022-12-01 09:08:41 +01:00
parent 67f43f98cb
commit 71379b1729
2 changed files with 5 additions and 3 deletions

View File

@ -1,3 +1,5 @@
# go-api-pkg
Base API go packages.
Remeber to tag as "dev" after changes are made in develop branch.

View File

@ -77,11 +77,11 @@ func (s *Service) UpdateTTL(service *consul.AgentServiceRegistration) {
for range ticker.C {
ok, err := s.check()
if !ok {
if err := s.ConsulAgent.FailTTL("service:"+s.Name, err.Error()); err != nil {
if err := s.ConsulAgent.FailTTL("service:"+s.AppID, err.Error()); err != nil {
log.Println(err)
}
} else {
if err := s.ConsulAgent.PassTTL("service:"+s.Name, "OK"); err != nil {
if err := s.ConsulAgent.PassTTL("service:"+s.AppID, "OK"); err != nil {
log.Println(err)
}
}