Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7bfd048051 | |||
| 1433b69abe |
@@ -54,7 +54,7 @@ func newClientConfig(serverAddr string) *consul.Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) GetID() string {
|
func (s *Service) GetID() string {
|
||||||
return fmt.Sprintf("%s_%s", s.Name, s.appID)
|
return fmt.Sprintf("%s:%s", s.Name, s.appID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) GetFullAddr() string {
|
func (s *Service) GetFullAddr() string {
|
||||||
@@ -117,12 +117,14 @@ func (s *Service) healthCheck() (bool, error) {
|
|||||||
healthUrl := s.GetFullAddr() + "health"
|
healthUrl := s.GetFullAddr() + "health"
|
||||||
req, err := http.NewRequest(http.MethodGet, healthUrl, nil)
|
req, err := http.NewRequest(http.MethodGet, healthUrl, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Printf("Failed to create new Consul request: %v\n", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
req.Header.Set("User-Agent", "Health Check")
|
req.Header.Set("User-Agent", "Health Check")
|
||||||
|
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Printf("Failed to send Consul request: %v\n", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|||||||
Reference in New Issue
Block a user