From 7866ff75fd6c1174f4a7b49ddf26a93fe38bef1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=85=E5=AD=90?= Date: Wed, 21 Sep 2022 15:21:56 +0800 Subject: [PATCH] fix(registry/consul): use health check option to control custom checks (#2391) --- contrib/registry/consul/client.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/contrib/registry/consul/client.go b/contrib/registry/consul/client.go index 55425dff1..c1364bb3f 100644 --- a/contrib/registry/consul/client.go +++ b/contrib/registry/consul/client.go @@ -132,6 +132,8 @@ func (c *Client) Register(_ context.Context, svc *registry.ServiceInstance, enab Timeout: "5s", }) } + // custom checks + asr.Checks = append(asr.Checks, c.serviceChecks...) } if c.heartbeat { asr.Checks = append(asr.Checks, &api.AgentServiceCheck{ @@ -141,9 +143,6 @@ func (c *Client) Register(_ context.Context, svc *registry.ServiceInstance, enab }) } - // custom checks - asr.Checks = append(asr.Checks, c.serviceChecks...) - err := c.cli.Agent().ServiceRegister(asr) if err != nil { return err