mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
only retry transport related errors
This commit is contained in:
parent
f7b21973ac
commit
004aa9ca5d
|
@ -1,6 +1,7 @@
|
||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"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 {
|
if err == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
glog.V(1).Infof("retry %s", name)
|
if strings.Contains(err.Error(), "transport: ") {
|
||||||
time.Sleep(waitTime)
|
glog.V(1).Infof("retry %s", name)
|
||||||
waitTime += waitTime / 2
|
time.Sleep(waitTime)
|
||||||
|
waitTime += waitTime / 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
Loading…
Reference in a new issue