randomize traffic if replicated
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
|
"math/rand"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -142,6 +143,9 @@ func retriedStreamFetchChunkData(writer io.Writer, urlStrings []string, cipherKe
|
|||||||
var shouldRetry bool
|
var shouldRetry bool
|
||||||
var totalWritten int
|
var totalWritten int
|
||||||
|
|
||||||
|
rand.Shuffle(len(urlStrings), func(i, j int) {
|
||||||
|
urlStrings[i], urlStrings[j] = urlStrings[j], urlStrings[i]
|
||||||
|
})
|
||||||
for waitTime := time.Second; waitTime < util.RetryWaitTime; waitTime += waitTime / 2 {
|
for waitTime := time.Second; waitTime < util.RetryWaitTime; waitTime += waitTime / 2 {
|
||||||
for _, urlString := range urlStrings {
|
for _, urlString := range urlStrings {
|
||||||
var localProcesed int
|
var localProcesed int
|
||||||
|
|||||||
Reference in New Issue
Block a user