diff --git a/.changelog/11005.txt b/.changelog/11005.txt new file mode 100644 index 000000000..f9874d760 --- /dev/null +++ b/.changelog/11005.txt @@ -0,0 +1,4 @@ + +```release-note:improvement +client: Speed up client startup time +``` diff --git a/client/client.go b/client/client.go index 2442bdb22..e259b4376 100644 --- a/client/client.go +++ b/client/client.go @@ -80,6 +80,10 @@ const ( // devModeRetryIntv is the retry interval used for development devModeRetryIntv = time.Second + // noServerRetryIntv is the retry interval used when client has not + // connected to server yet + noServerRetryIntv = time.Second + // stateSnapshotIntv is how often the client snapshots state stateSnapshotIntv = 60 * time.Second @@ -1772,15 +1776,17 @@ func (c *Client) retryRegisterNode() { return } + retryIntv := registerRetryIntv if err == noServersErr { c.logger.Debug("registration waiting on servers") c.triggerDiscovery() + retryIntv = noServerRetryIntv } else { c.logger.Error("error registering", "error", err) } select { case <-c.rpcRetryWatcher(): - case <-time.After(c.retryIntv(registerRetryIntv)): + case <-time.After(c.retryIntv(retryIntv)): case <-c.shutdownCh: return }