diff options
| author | hilimd <68371223+hilimd@users.noreply.github.com> | 2020-10-14 16:39:45 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-14 16:39:45 +0800 |
| commit | a91137579857a3ef40725dccda85f40d0ac77223 (patch) | |
| tree | ab389cfefe7796600aeaca14773992daf7746752 /weed/filer/filechunk_manifest.go | |
| parent | 2ff727a32d6d879a49ff5848b592518c96bb6403 (diff) | |
| parent | 1069b325dd92b6a1b16a20290acc8129d5e19ef8 (diff) | |
| download | seaweedfs-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.go | 10 |
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 |
