From b117725dc94344082c512c0b953665c8cf7e046f Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Wed, 28 Sep 2016 17:18:45 -0700 Subject: [PATCH] Only log consul errors once since last succesful run --- client/client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index 58072b4bf..dfb9c032e 100644 --- a/client/client.go +++ b/client/client.go @@ -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