move to util.RetryWaitTime

This commit is contained in:
Chris Lu
2020-11-01 02:36:43 -08:00
parent ef908e166b
commit 8750cac090
7 changed files with 17 additions and 20 deletions

View File

@@ -99,7 +99,7 @@ func retriedFetchChunkData(urlStrings []string, cipherKey []byte, isGzipped bool
var buffer bytes.Buffer
var shouldRetry bool
for waitTime := time.Second; waitTime < ReadWaitTime; waitTime += waitTime / 2 {
for waitTime := time.Second; waitTime < util.RetryWaitTime; waitTime += waitTime / 2 {
for _, urlString := range urlStrings {
shouldRetry, err = util.ReadUrlAsStream(urlString+"?readDeleted=true", cipherKey, isGzipped, isFullChunk, offset, size, func(data []byte) {
buffer.Write(data)

View File

@@ -3,20 +3,16 @@ package filer
import (
"context"
"fmt"
"io"
"math/rand"
"sync"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/util/chunk_cache"
"github.com/chrislusf/seaweedfs/weed/wdclient"
"github.com/golang/groupcache/singleflight"
"io"
"math/rand"
"sync"
"time"
)
var (
ReadWaitTime = 6 * time.Second
)
type ChunkReadAt struct {
@@ -47,7 +43,7 @@ func LookupFn(filerClient filer_pb.FilerClient) LookupFileIdFunctionType {
vicCacheLock.RUnlock()
if !found {
util.Retry("lookup volume "+vid, ReadWaitTime, func() error {
util.Retry("lookup volume "+vid, func() error {
err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
resp, err := client.LookupVolume(context.Background(), &filer_pb.LookupVolumeRequest{
VolumeIds: []string{vid},