diff --git a/contrib/registry/consul/registry.go b/contrib/registry/consul/registry.go index da9a899f7aa..3660997b0fb 100644 --- a/contrib/registry/consul/registry.go +++ b/contrib/registry/consul/registry.go @@ -262,7 +262,7 @@ func (r *Registry) resolve(ctx context.Context, ss *serviceSet) error { } continue } - if len(tmpService) != 0 && tmpIdx != idx { + if tmpIdx != idx { services = tmpService ss.broadcast(services) } diff --git a/contrib/registry/consul/registry_test.go b/contrib/registry/consul/registry_test.go index 12c95e33ed1..2cb0b39e53b 100644 --- a/contrib/registry/consul/registry_test.go +++ b/contrib/registry/consul/registry_test.go @@ -391,7 +391,7 @@ func TestRegistry_Watch(t *testing.T) { opts: []Option{ WithHeartbeat(true), WithHealthCheck(true), - WithHealthCheckInterval(5), + WithHealthCheckInterval(1), }, }, want: []*registry.ServiceInstance{instance3},