Small bug fix. Can't close a connection that doesn't exist
This commit is contained in:
parent
073faabc21
commit
b740c1a61a
1 changed files with 3 additions and 1 deletions
4
zk.go
4
zk.go
|
@ -39,13 +39,15 @@ type ServiceInstance struct {
|
|||
func LeaderFromZK(cluster Cluster) (string, error) {
|
||||
|
||||
endpoints := strings.Split(cluster.ZK, ",")
|
||||
|
||||
//TODO (rdelvalle): When enabling debugging, change logger here
|
||||
c, _, err := zk.Connect(endpoints, time.Second*10, zk.WithoutLogger())
|
||||
defer c.Close()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "Failed to connect to Zookeeper at "+cluster.ZK)
|
||||
}
|
||||
|
||||
defer c.Close()
|
||||
|
||||
children, _, _, err := c.ChildrenW(cluster.SchedZKPath)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "Path %s doesn't exist on Zookeeper ", cluster.SchedZKPath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue