mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
minor fixes
This commit is contained in:
@@ -3,8 +3,6 @@ package cloudprovider
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/log"
|
||||
)
|
||||
|
||||
func IsError(err error, errs []string) bool {
|
||||
@@ -31,17 +29,3 @@ func RetryOnError(tryFunc func() error, errs []string, maxTries int) error {
|
||||
}
|
||||
return ErrTimeout
|
||||
}
|
||||
|
||||
func Retry(tryFunc func() error, maxTries int) error {
|
||||
tried := 0
|
||||
for tried < maxTries {
|
||||
err := tryFunc()
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
tried += 1
|
||||
log.Errorf("Tried %d fail %s", tried, err)
|
||||
time.Sleep(10 * time.Duration(tried) * time.Second)
|
||||
}
|
||||
return ErrTimeout
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user