remove the periodic session renewal in Consul until we figure out what to do with etcd..

Signed-off-by: Alexandre Beslic <abronan@docker.com>
This commit is contained in:
Alexandre Beslic 2015-05-19 12:31:39 -07:00
parent ec478d8ed5
commit 5d106186fb
1 changed files with 6 additions and 16 deletions

View File

@ -144,23 +144,13 @@ func (s *Consul) Put(key string, value []byte, opts *WriteOptions) error {
s.sessions[key] = session s.sessions[key] = session
p.Session = session p.Session = session
}
// Renew the session periodically if heartbeat set // Renew the session
if opts.Heartbeat != 0 { _, _, err := s.client.Session().Renew(p.Session, nil)
go func() { if err != nil {
ticker := time.NewTicker(opts.Heartbeat) delete(s.sessions, key)
for { return err
select {
case <-ticker.C:
_, _, err := s.client.Session().Renew(p.Session, nil)
if err != nil {
delete(s.sessions, key)
return
}
}
}
}()
}
} }
} }