diff --git a/contrib/registry/eureka/watcher.go b/contrib/registry/eureka/watcher.go index de37d3229..0d526fa9a 100644 --- a/contrib/registry/eureka/watcher.go +++ b/contrib/registry/eureka/watcher.go @@ -33,7 +33,7 @@ func newWatch(ctx context.Context, cli *API, serverName string) (*watcher, error return w, e } -func (w watcher) Next() (services []*registry.ServiceInstance, err error) { +func (w *watcher) Next() (services []*registry.ServiceInstance, err error) { select { case <-w.ctx.Done(): return nil, w.ctx.Err() diff --git a/contrib/registry/servicecomb/registry.go b/contrib/registry/servicecomb/registry.go index 894cf343a..3e2a0e9f9 100644 --- a/contrib/registry/servicecomb/registry.go +++ b/contrib/registry/servicecomb/registry.go @@ -147,6 +147,7 @@ func (r *Registry) Register(_ context.Context, svcIns *registry.ServiceInstance) return err } ticker := time.NewTicker(30 * time.Second) + defer ticker.Stop() go func() { for { <-ticker.C