From 046c3d5ad4797869ebdceb7e657adc363410f572 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Tue, 26 Jul 2022 11:47:11 +0500 Subject: [PATCH 1/2] fix logic else brake --- weed/filer/stream.go | 1 + 1 file changed, 1 insertion(+) diff --git a/weed/filer/stream.go b/weed/filer/stream.go index 12a870c80..9f2991a02 100644 --- a/weed/filer/stream.go +++ b/weed/filer/stream.go @@ -81,6 +81,7 @@ func StreamContent(masterClient wdclient.HasLookupFileIdFunction, writer io.Writ urlStrings, err = masterClient.GetLookupFileIdFunction()(chunkView.FileId) if err != nil || len(urlStrings) == 0 { time.Sleep(backoff) + } else { break } } From da9d3e8f6ce7f5f6dfa94c26a562d41677c12727 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Tue, 26 Jul 2022 11:56:45 +0500 Subject: [PATCH 2/2] refactor --- weed/filer/stream.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/weed/filer/stream.go b/weed/filer/stream.go index 9f2991a02..ed30ce5b0 100644 --- a/weed/filer/stream.go +++ b/weed/filer/stream.go @@ -79,11 +79,10 @@ func StreamContent(masterClient wdclient.HasLookupFileIdFunction, writer io.Writ var err error for _, backoff := range getLookupFileIdBackoffSchedule { urlStrings, err = masterClient.GetLookupFileIdFunction()(chunkView.FileId) - if err != nil || len(urlStrings) == 0 { - time.Sleep(backoff) - } else { + if err == nil && len(urlStrings) > 0 { break } + time.Sleep(backoff) } if err != nil { glog.V(1).Infof("operation LookupFileId %s failed, err: %v", chunkView.FileId, err)