Skip to content

Commit aaea192

Browse files
authored
Always reset agent connection backoff and enter fast sync when client count < server count (#632)
* Always reset backoff and enter fast sync when clien count < server count * Only call ClientsCount() once * Review comment
1 parent 4c75cf6 commit aaea192

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/agent/clientset.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,13 @@ func (cs *ClientSet) sync() {
183183
for {
184184
if err := cs.connectOnce(); err != nil {
185185
if dse, ok := err.(*DuplicateServerError); ok {
186-
klog.V(4).InfoS("duplicate server", "serverID", dse.ServerID, "serverCount", cs.serverCount, "clientsCount", cs.ClientsCount())
187-
if cs.serverCount != 0 && cs.ClientsCount() >= cs.serverCount {
186+
clientsCount := cs.ClientsCount()
187+
klog.V(4).InfoS("duplicate server", "serverID", dse.ServerID, "serverCount", cs.serverCount, "clientsCount", clientsCount)
188+
if cs.serverCount != 0 && clientsCount >= cs.serverCount {
188189
duration = backoff.Step()
190+
} else {
191+
backoff = cs.resetBackoff()
192+
duration = wait.Jitter(backoff.Duration, backoff.Jitter)
189193
}
190194
} else {
191195
klog.ErrorS(err, "cannot connect once")

0 commit comments

Comments
 (0)