Updating zookeeper dependency since logging problem has been solved in main repository. Go fmt run on project to tidy it up.
This commit is contained in:
parent
b3e55be98b
commit
3bf2e8a831
13 changed files with 296 additions and 152 deletions
7
zk.go
7
zk.go
|
@ -35,13 +35,18 @@ type ServiceInstance struct {
|
|||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type NoopLogger struct{}
|
||||
|
||||
func (NoopLogger) Printf(format string, a ...interface{}) {
|
||||
}
|
||||
|
||||
// Loads leader from ZK endpoint.
|
||||
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())
|
||||
c, _, err := zk.Connect(endpoints, time.Second*10, func(c *zk.Conn) { c.SetLogger(NoopLogger{}) })
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "Failed to connect to Zookeeper at "+cluster.ZK)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue