|
|
@ -1,6 +1,7 @@ |
|
|
|
package util |
|
|
|
|
|
|
|
import ( |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/glog" |
|
|
@ -13,9 +14,11 @@ func Retry(name string, waitTimeLimit time.Duration, job func() error) (err erro |
|
|
|
if err == nil { |
|
|
|
break |
|
|
|
} |
|
|
|
glog.V(1).Infof("retry %s", name) |
|
|
|
time.Sleep(waitTime) |
|
|
|
waitTime += waitTime / 2 |
|
|
|
if strings.Contains(err.Error(), "transport: ") { |
|
|
|
glog.V(1).Infof("retry %s", name) |
|
|
|
time.Sleep(waitTime) |
|
|
|
waitTime += waitTime / 2 |
|
|
|
} |
|
|
|
} |
|
|
|
return err |
|
|
|
} |