INNER CODE UNIT · Go
minCount
pingcap/tidb-operator · cmd/prestop-checker/main.go:186
minCount := math.MaxInt
var failTimes, retryTimes int
if err := wait.PollUntilContextCancel(ctx, time.Second, true, func(ctx context.Context) (done bool, err error) {
leaderCount, err := cfg.Client.GetLeaderCount()
if err != nil {
fmt.Printf("cannot get leader count, try again, retryTimes %v: %v\n", retryTimes, err)
retryTimes += 1
if retryTimes > maxRetryTimes {
return false, fmt.Errorf("retry too many times")
}
return false, nil
}
retryTimes = 0
if leaderCount == 0 {
return true, nil
}
if leaderCount >= minCount {