diff --git a/consul/discovery.go b/consul/discovery.go index 5b33196..64767c8 100644 --- a/consul/discovery.go +++ b/consul/discovery.go @@ -87,15 +87,15 @@ func (s *Service) Register() error { } }(s) - // go func(s *Service) { // TTL - // interval := s.ttl - time.Second*2 // 2 seconds overhead - // ticker := time.NewTicker(interval) - // for range ticker.C { - // if _, err := s.healthCheck(); err != nil { - // fmt.Printf("TTL Error #: %v\n", err) - // } - // } - // }(s) + go func(s *Service) { // TTL + interval := s.ttl - time.Second*2 // 2 seconds overhead + ticker := time.NewTicker(interval) + for range ticker.C { + if _, err := s.healthCheck(); err != nil { + fmt.Printf("TTL Error #: %v\n", err) + } + } + }(s) return nil }