From 004aa9ca5d9575851e667b4229f721e60424419f Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 1 Nov 2020 01:21:44 -0700 Subject: [PATCH] only retry transport related errors --- weed/util/retry.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/weed/util/retry.go b/weed/util/retry.go index 7d6d8da23..65cf07b41 100644 --- a/weed/util/retry.go +++ b/weed/util/retry.go @@ -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 } \ No newline at end of file