From 4af8c427ebb15451d1e2516859e5840ba9ed41b7 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sat, 10 Sep 2022 16:56:03 -0700 Subject: [PATCH] refactor --- weed/operation/upload_content.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go index af1edea75..ee72d1285 100644 --- a/weed/operation/upload_content.go +++ b/weed/operation/upload_content.go @@ -156,14 +156,15 @@ func doUpload(reader io.Reader, option *UploadOption) (uploadResult *UploadResul func retriedUploadData(data []byte, option *UploadOption) (uploadResult *UploadResult, err error) { for i := 0; i < 3; i++ { + if i > 0 { + time.Sleep(time.Millisecond * time.Duration(237*(i+1))) + } uploadResult, err = doUploadData(data, option) if err == nil { uploadResult.RetryCount = i return - } else { - glog.Warningf("uploading %d to %s: %v", i, option.UploadUrl, err) } - time.Sleep(time.Millisecond * time.Duration(237*(i+1))) + glog.Warningf("uploading %d to %s: %v", i, option.UploadUrl, err) } return }