consul ttl fix

This commit is contained in:
Piotr Biernat 2022-12-02 17:42:39 +01:00
parent 128e3db0b6
commit 3b6acdc195

View File

@ -81,9 +81,15 @@ func (s *Service) Register() error {
}()
go func() { // TTL
ticker := time.NewTicker(s.TTL - 3)
// interval := s.TTL - time.Second*3
// ticker := time.NewTicker(interval /*s.TTL*/)
ticker := time.NewTicker(s.TTL)
for range ticker.C {
s.healthCheck()
fmt.Println("HC call: ", time.Now().String())
_, err := s.healthCheck()
if err != nil {
fmt.Printf("TTL Error: %v\n", err)
}
}
}()