From 3b6acdc1950ca92b9de643dc0acc3d5558a34f93 Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Fri, 2 Dec 2022 17:42:39 +0100 Subject: [PATCH] consul ttl fix --- consul/discovery.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/consul/discovery.go b/consul/discovery.go index b89ce2f..80815cd 100644 --- a/consul/discovery.go +++ b/consul/discovery.go @@ -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) + } } }()