1
0
mirror of https://github.com/docker/docs.git synced 2026-11-06 12:54:24 +03:00

Merge pull request #567 from mgoelzer/issue564

Make TTL > heartbeat interval so that keys do not disappear
This commit is contained in:
Andrea Luzzardi
2015-04-03 16:06:23 -07:00

View File

@@ -40,7 +40,8 @@ func (s *EtcdDiscoveryService) Initialize(uris string, heartbeat int) error {
}
s.client = etcd.NewClient(entries)
s.ttl = uint64(heartbeat * 3 / 2)
// ttl should always be > heartbeat, even if heartbeat = 1 or 0
s.ttl = uint64(heartbeat*3/2) + 1
s.path = "/" + parts[1] + "/"
if _, err := s.client.CreateDir(s.path, s.ttl); err != nil {
if etcdError, ok := err.(*etcd.EtcdError); ok {