From 1519dcb3e17722436f42a0312d30d5e6e1b01a5e Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Fri, 7 Aug 2020 23:44:43 +0100 Subject: [PATCH] initChan is never evaluated because watchRegistry is a blocking call --- registry.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/registry.go b/registry.go index 5b27a45..70aee7d 100644 --- a/registry.go +++ b/registry.go @@ -272,6 +272,8 @@ func (r *rtr) watchRegistry(w registry.Watcher) error { select { case <-exit: return + case <-r.initChan: + return case <-r.exit: return } @@ -578,14 +580,6 @@ func (r *rtr) start() error { w.Stop() } return - case <-r.initChan: - // the registry could have changed during initialization - // so if there was a watcher setup, stop it and create a - // new one - if w != nil { - w.Stop() - w = nil - } default: if w == nil { w, err = r.options.Registry.Watch(registry.WatchDomain(registry.WildcardDomain))