Skip to content

Commit

Permalink
Merge 6a19992 into 85740b1
Browse files Browse the repository at this point in the history
  • Loading branch information
lawlielt committed Jan 4, 2024
2 parents 85740b1 + 6a19992 commit d251d6c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion contrib/registry/consul/client.go
Expand Up @@ -220,7 +220,11 @@ func (c *Client) Register(_ context.Context, svc *registry.ServiceInstance, enab
_ = c.cli.Agent().ServiceDeregister(svc.ID)
return
}
err = c.cli.Agent().UpdateTTL("service:"+svc.ID, "pass", "pass")
err = c.cli.Agent().UpdateTTLOpts("service:"+svc.ID, "pass", "pass", new(api.QueryOptions).WithContext(c.ctx))
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
_ = c.cli.Agent().ServiceDeregister(svc.ID)
return
}
if err != nil {
log.Errorf("[Consul] update ttl heartbeat to consul failed! err=%v", err)
// when the previous report fails, try to re register the service
Expand Down

0 comments on commit d251d6c

Please sign in to comment.