Compare commits

...

4 Commits

Author SHA1 Message Date
1018e24060 Updated TTL param 2025-04-26 12:05:55 +02:00
ebef6e138d Consul update 2024-12-24 18:15:48 +01:00
7bd8f754d8 Consul update 2024-12-24 18:10:41 +01:00
43574a1d1c Consul update 2024-12-24 18:04:55 +01:00

View File

@@ -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)