aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/filechunk_manifest.go
diff options
context:
space:
mode:
authorhilimd <68371223+hilimd@users.noreply.github.com>2020-10-14 16:39:45 +0800
committerGitHub <noreply@github.com>2020-10-14 16:39:45 +0800
commita91137579857a3ef40725dccda85f40d0ac77223 (patch)
treeab389cfefe7796600aeaca14773992daf7746752 /weed/filer/filechunk_manifest.go
parent2ff727a32d6d879a49ff5848b592518c96bb6403 (diff)
parent1069b325dd92b6a1b16a20290acc8129d5e19ef8 (diff)
downloadseaweedfs-a91137579857a3ef40725dccda85f40d0ac77223.tar.xz
seaweedfs-a91137579857a3ef40725dccda85f40d0ac77223.zip
Merge pull request #26 from chrislusf/master
sync
Diffstat (limited to 'weed/filer/filechunk_manifest.go')
-rw-r--r--weed/filer/filechunk_manifest.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/weed/filer/filechunk_manifest.go b/weed/filer/filechunk_manifest.go
index 2df8a4bbf..f45448a6e 100644
--- a/weed/filer/filechunk_manifest.go
+++ b/weed/filer/filechunk_manifest.go
@@ -97,12 +97,16 @@ func retriedFetchChunkData(urlStrings []string, cipherKey []byte, isGzipped bool
var err error
var buffer bytes.Buffer
+ var shouldRetry bool
for waitTime := time.Second; waitTime < ReadWaitTime; waitTime += waitTime / 2 {
for _, urlString := range urlStrings {
- err = util.ReadUrlAsStream(urlString, cipherKey, isGzipped, isFullChunk, offset, size, func(data []byte) {
+ shouldRetry, err = util.ReadUrlAsStream(urlString, cipherKey, isGzipped, isFullChunk, offset, size, func(data []byte) {
buffer.Write(data)
})
+ if !shouldRetry {
+ break
+ }
if err != nil {
glog.V(0).Infof("read %s failed, err: %v", urlString, err)
buffer.Reset()
@@ -110,8 +114,8 @@ func retriedFetchChunkData(urlStrings []string, cipherKey []byte, isGzipped bool
break
}
}
- if err != nil {
- glog.V(0).Infof("sleep for %v before retrying reading", waitTime)
+ if err != nil && shouldRetry {
+ glog.V(0).Infof("retry reading in %v", waitTime)
time.Sleep(waitTime)
} else {
break