From 359a89ba6247cff15a78231eec90adf96a8cbb7a Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Fri, 19 Apr 2024 19:01:16 +0200 Subject: [PATCH] consul fixes --- consul/discovery.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/consul/discovery.go b/consul/discovery.go index 6cbb5ac..53959fd 100644 --- a/consul/discovery.go +++ b/consul/discovery.go @@ -109,7 +109,7 @@ func (s *Service) RegisterHealthChecks() { }() go func() { // TTL - interval := s.ttl - time.Second*2 // 2 seconds overhead + interval := s.ttl - (time.Second * 2) // 2 seconds overhead ticker := time.NewTicker(interval) for range ticker.C { if _, err := s.healthCheck(); err != nil { @@ -149,17 +149,14 @@ func (s *Service) healthCheck() (bool, error) { } req.Header.Set("User-Agent", "service/internal") - fmt.Printf("Sending HEALTH CHECK request to: %s\n", healthUrl) resp, err := client.Do(req) if err != nil { - fmt.Printf("Sending HEALTH CHECK request error: %v\n", err) return false } defer resp.Body.Close() var body []byte resp.Body.Read(body) - fmt.Printf("HEALTH CHECK response to: %v -- %v\n", resp, body) return resp.StatusCode == http.StatusOK }()