Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1018e24060 | |||
| ebef6e138d | |||
| 7bd8f754d8 | |||
| 43574a1d1c |
@@ -2,12 +2,11 @@ package consul
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.pbiernat.io/egommerce/go-api-pkg/config"
|
"git.ego.cloudns.be/egommerce/go-api-pkg/config"
|
||||||
consul "github.com/hashicorp/consul/api"
|
consul "github.com/hashicorp/consul/api"
|
||||||
"github.com/hashicorp/consul/connect"
|
"github.com/hashicorp/consul/connect"
|
||||||
)
|
)
|
||||||
@@ -61,7 +60,6 @@ func NewService(servAddr, id, name, useDomainOverIp, addr, domain, pathPrefix st
|
|||||||
|
|
||||||
func newClientConfig(serverAddr string) *consul.Config {
|
func newClientConfig(serverAddr string) *consul.Config {
|
||||||
conf := consul.DefaultConfig()
|
conf := consul.DefaultConfig()
|
||||||
log.Printf("Setting consul server addr: %s", serverAddr)
|
|
||||||
conf.Address = serverAddr
|
conf.Address = serverAddr
|
||||||
|
|
||||||
return conf
|
return conf
|
||||||
@@ -129,7 +127,7 @@ func (s *Service) RegisterHealthChecks() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
go func() { // TTL
|
go func() { // TTL
|
||||||
t := time.NewTicker(s.ttl)
|
t := time.NewTicker(time.Second * 5)
|
||||||
for range t.C {
|
for range t.C {
|
||||||
if _, err := s.healthCheck(); err != nil {
|
if _, err := s.healthCheck(); err != nil {
|
||||||
// fmt.Printf("HealthCheck endpoint not available (%s)#: %v\n", s.GetFullAddr(), err)
|
// fmt.Printf("HealthCheck endpoint not available (%s)#: %v\n", s.GetFullAddr(), err)
|
||||||
|
|||||||
Reference in New Issue
Block a user