fixes in Consul KV base support
This commit is contained in:
parent
39a8327463
commit
f138b9b61e
@ -72,7 +72,7 @@ func (s *Service) Register() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() { // startup register
|
go func(s *Service) { // startup register
|
||||||
ticker := time.NewTicker(time.Millisecond * 100)
|
ticker := time.NewTicker(time.Millisecond * 100)
|
||||||
for range ticker.C {
|
for range ticker.C {
|
||||||
ok, _ := s.healthCheck()
|
ok, _ := s.healthCheck()
|
||||||
@ -80,9 +80,9 @@ func (s *Service) Register() error {
|
|||||||
ticker.Stop()
|
ticker.Stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}(s)
|
||||||
|
|
||||||
go func() { // TTL
|
go func(s *Service) { // TTL
|
||||||
interval := s.ttl - time.Second*2
|
interval := s.ttl - time.Second*2
|
||||||
ticker := time.NewTicker(interval)
|
ticker := time.NewTicker(interval)
|
||||||
for range ticker.C {
|
for range ticker.C {
|
||||||
@ -91,7 +91,7 @@ func (s *Service) Register() error {
|
|||||||
fmt.Printf("TTL Error: %v\n", err)
|
fmt.Printf("TTL Error: %v\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}(s)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user