Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up client startup and registration #11005

Merged
merged 2 commits into from
Aug 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}
Expand Down