Skip to content

Commit

Permalink
Always reset agent connection backoff and enter fast sync when client…
Browse files Browse the repository at this point in the history
… count < server count (#632)

* Always reset backoff and enter fast sync when clien count < server count

* Only call ClientsCount() once

* Review comment
  • Loading branch information
carreter authored Jun 18, 2024
1 parent 4c75cf6 commit aaea192
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/agent/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ func (cs *ClientSet) sync() {
for {
if err := cs.connectOnce(); err != nil {
if dse, ok := err.(*DuplicateServerError); ok {
klog.V(4).InfoS("duplicate server", "serverID", dse.ServerID, "serverCount", cs.serverCount, "clientsCount", cs.ClientsCount())
if cs.serverCount != 0 && cs.ClientsCount() >= cs.serverCount {
clientsCount := cs.ClientsCount()
klog.V(4).InfoS("duplicate server", "serverID", dse.ServerID, "serverCount", cs.serverCount, "clientsCount", clientsCount)
if cs.serverCount != 0 && clientsCount >= cs.serverCount {
duration = backoff.Step()
} else {
backoff = cs.resetBackoff()
duration = wait.Jitter(backoff.Duration, backoff.Jitter)
}
} else {
klog.ErrorS(err, "cannot connect once")
Expand Down

0 comments on commit aaea192

Please sign in to comment.