INNER CODE UNIT · Go
RunTiKVPrestopHook
pingcap/tidb-operator · cmd/prestop-checker/main.go:154
func RunTiKVPrestopHook(ctx context.Context, cfg *TiKVConfig) error {
var storeID string
//nolint:mnd // refactor to a constant if needed
if err := wait.PollUntilContextTimeout(ctx, time.Second, time.Second*15, true,
func(ctx context.Context) (done bool, err error) {
info, err := cfg.PDClient.GetStores(ctx)
if err != nil {
fmt.Printf("cannot list stores, try again: %v\n", err)
return false, nil
}
for _, s := range info.Stores {
if s.Store == nil {
continue
}
if s.Store.StatusAddress != cfg.StatusAddr {
continue