diff --git a/consul/discovery.go b/consul/discovery.go index bc7dac0..722f7f7 100644 --- a/consul/discovery.go +++ b/consul/discovery.go @@ -80,19 +80,17 @@ func (s *Service) Register() error { go func(s *Service) { // startup register ticker := time.NewTicker(time.Millisecond * 100) for range ticker.C { - ok, _ := s.healthCheck() - if ok { + if ok, _ := s.healthCheck(); ok { ticker.Stop() } } }(s) go func(s *Service) { // TTL - interval := s.ttl - time.Second*2 + interval := s.ttl - time.Second*2 // 2 seconds overhead ticker := time.NewTicker(interval) for range ticker.C { - _, err := s.healthCheck() - if err != nil { + if _, err := s.healthCheck(); err != nil { fmt.Printf("TTL Error: %v\n", err) } }