consul fixes
This commit is contained in:
parent
3b73091cfb
commit
359a89ba62
@ -109,7 +109,7 @@ func (s *Service) RegisterHealthChecks() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
go func() { // TTL
|
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)
|
ticker := time.NewTicker(interval)
|
||||||
for range ticker.C {
|
for range ticker.C {
|
||||||
if _, err := s.healthCheck(); err != nil {
|
if _, err := s.healthCheck(); err != nil {
|
||||||
@ -149,17 +149,14 @@ func (s *Service) healthCheck() (bool, error) {
|
|||||||
}
|
}
|
||||||
req.Header.Set("User-Agent", "service/internal")
|
req.Header.Set("User-Agent", "service/internal")
|
||||||
|
|
||||||
fmt.Printf("Sending HEALTH CHECK request to: %s\n", healthUrl)
|
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Sending HEALTH CHECK request error: %v\n", err)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
var body []byte
|
var body []byte
|
||||||
resp.Body.Read(body)
|
resp.Body.Read(body)
|
||||||
fmt.Printf("HEALTH CHECK response to: %v -- %v\n", resp, body)
|
|
||||||
|
|
||||||
return resp.StatusCode == http.StatusOK
|
return resp.StatusCode == http.StatusOK
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user