registry/consul: rename "RegisterTCPCheck" to "TCPCheck"
This commit is contained in:
parent
68ab671bd0
commit
1eb4398b6c
@ -18,13 +18,13 @@ func Config(c *consul.Config) registry.Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// RegisterTCPCheck will tell the service provider to check the service address
|
// TCPCheck will tell the service provider to check the service address
|
||||||
// and port every `t` interval. It will enabled only if `t` is greater than 0.
|
// and port every `t` interval. It will enabled only if `t` is greater than 0.
|
||||||
// See `TCP + Interval` for more information [1].
|
// See `TCP + Interval` for more information [1].
|
||||||
//
|
//
|
||||||
// [1] https://www.consul.io/docs/agent/checks.html
|
// [1] https://www.consul.io/docs/agent/checks.html
|
||||||
//
|
//
|
||||||
func RegisterTCPCheck(t time.Duration) registry.Option {
|
func TCPCheck(t time.Duration) registry.Option {
|
||||||
return func(o *registry.Options) {
|
return func(o *registry.Options) {
|
||||||
if t <= time.Duration(0) {
|
if t <= time.Duration(0) {
|
||||||
return
|
return
|
||||||
@ -32,7 +32,6 @@ func RegisterTCPCheck(t time.Duration) registry.Option {
|
|||||||
if o.Context == nil {
|
if o.Context == nil {
|
||||||
o.Context = context.Background()
|
o.Context = context.Background()
|
||||||
}
|
}
|
||||||
o.Context = context.WithValue(o.Context,
|
o.Context = context.WithValue(o.Context, "consul_register_tcp_check", t)
|
||||||
registry.ConsulRegisterTCPCheckKey, t)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user