From bf72619e8cda0d35daae3ab072cdcaf1a1a0c8a0 Mon Sep 17 00:00:00 2001 From: Chelsea Holland Komlo Date: Thu, 1 Mar 2018 09:48:26 -0500 Subject: [PATCH] simplify retry logic --- client/client.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/client.go b/client/client.go index 5861b6f81..705efb524 100644 --- a/client/client.go +++ b/client/client.go @@ -1544,9 +1544,6 @@ func (c *Client) watchNodeUpdates() { for { select { case <-timer.C: - if !hasChanged { - continue - } c.logger.Printf("[DEBUG] client: state changed, updating node and re-registering.") // Update the config copy. @@ -1558,9 +1555,12 @@ func (c *Client) watchNodeUpdates() { c.retryRegisterNode() hasChanged = false - timer.Reset(c.retryIntv(nodeUpdateRetryIntv)) case <-c.triggerNodeUpdate: + if hasChanged { + continue + } hasChanged = true + timer.Reset(c.retryIntv(nodeUpdateRetryIntv)) case <-c.shutdownCh: return }