Skip to content

Commit

Permalink
Merge pull request kelseyhightower#112 from carmstrong/add_dial_timeout
Browse files Browse the repository at this point in the history
Set DialTimeout in etcd client
  • Loading branch information
kelseyhightower committed Aug 8, 2014
2 parents 7f5790f + ab64315 commit e2a25af
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backends/etcd/etcdutil/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package etcdutil
import (
"errors"
"strings"
"time"

"github.com/coreos/go-etcd/etcd"
)
Expand All @@ -31,6 +32,8 @@ func NewEtcdClient(machines []string, cert, key string, caCert string) (*Client,
} else {
c = etcd.NewClient(machines)
}
// Configure the DialTimeout, since 1 second is often too short
c.SetDialTimeout(time.Duration(3) * time.Second)
success := c.SetCluster(machines)
if !success {
return &Client{c}, errors.New("cannot connect to etcd cluster: " + strings.Join(machines, ","))
Expand Down

0 comments on commit e2a25af

Please sign in to comment.