tiup
tiup copied to clipboard
Retry function timeout parameter invalid
Bug Report
https://github.com/pingcap/tiup/blob/master/pkg/utils/retry.go#L80-L92
for attemptCount = 0; attemptCount < cfg.Attempts; attemptCount++ {
if err := doFunc(); err == nil {
return nil
}
// check for timeout
select {
case <-timeoutChan:
return fmt.Errorf("operation timed out after %s", cfg.Timeout)
default:
time.Sleep(cfg.Delay)
}
}
It looks like the Retry function will always wait for doFunc() to complete and then check the timeout channel.
I'm not sure, are you saying that we should put doFunc() into the default of select sentence? Or could you provide more details about what you did and why you think it's not working as your expected?