Only log consul errors once since last succesful run

This commit is contained in:
Michael Schurter 2016-09-28 17:18:45 -07:00
parent c0e142759b
commit b117725dc9

View file

@ -1607,11 +1607,17 @@ DISCOLOOP:
func (c *Client) consulReaper() {
ticker := time.NewTicker(consulReaperIntv)
defer ticker.Stop()
lastok := true
for {
select {
case <-ticker.C:
if err := c.consulReaperImpl(); err != nil {
c.logger.Printf("[ERR] consul.client: error reaping services in consul: %v", err)
if lastok {
c.logger.Printf("[ERR] consul.client: error reaping services in consul: %v", err)
lastok = false
}
} else {
lastok = true
}
case <-c.shutdownCh:
return