From 0b93fd6d5e147590516dc7dcbaa48e356d99c1ea Mon Sep 17 00:00:00 2001 From: Krasi Georgiev Date: Fri, 6 Jul 2018 10:39:38 +0300 Subject: [PATCH] fix the zookeper race (#4355) Signed-off-by: Krasi Georgiev --- discovery/zookeeper/zookeeper.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/discovery/zookeeper/zookeeper.go b/discovery/zookeeper/zookeeper.go index 60a26e860..487121457 100644 --- a/discovery/zookeeper/zookeeper.go +++ b/discovery/zookeeper/zookeeper.go @@ -137,8 +137,11 @@ func NewDiscovery( logger = log.NewNopLogger() } - conn, _, err := zk.Connect(srvs, timeout) - conn.SetLogger(treecache.NewZookeeperLogger(logger)) + conn, _, err := zk.Connect( + srvs, timeout, + func(c *zk.Conn) { + c.SetLogger(treecache.NewZookeeperLogger(logger)) + }) if err != nil { return nil }