From 6da8eef54f607106fe6037a858755d313dd1ab9e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 9 Oct 2020 00:01:47 -0700 Subject: [PATCH] fix logic error --- weed/filer/filechunk_manifest.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/weed/filer/filechunk_manifest.go b/weed/filer/filechunk_manifest.go index 8fd12c609..9e53e008f 100644 --- a/weed/filer/filechunk_manifest.go +++ b/weed/filer/filechunk_manifest.go @@ -98,7 +98,7 @@ func retriedFetchChunkData(urlStrings []string, cipherKey []byte, isGzipped bool var err error var buffer bytes.Buffer - for waitTime := time.Second; waitTime < 10*time.Minute; waitTime += waitTime / 2 { + for waitTime := time.Second; waitTime < 10*time.Second; waitTime += waitTime / 2 { for _, urlString := range urlStrings { err = util.ReadUrlAsStream(urlString, cipherKey, isGzipped, isFullChunk, offset, size, func(data []byte) { buffer.Write(data) @@ -110,8 +110,12 @@ func retriedFetchChunkData(urlStrings []string, cipherKey []byte, isGzipped bool break } } - glog.V(0).Infof("sleep for %v before retrying reading", waitTime) - time.Sleep(waitTime) + if err != nil { + glog.V(0).Infof("sleep for %v before retrying reading", waitTime) + time.Sleep(waitTime) + } else { + break + } } return buffer.Bytes(), err