aboutsummaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2014-03-16 13:50:20 -0700
committerChris Lu <chris.lu@gmail.com>2014-03-16 13:50:20 -0700
commit1040761ab682f63cbecdd70be08343bb934c3380 (patch)
treec36a20a6795e994e86d4ed46d8f2c57daedfa6f2 /go
parent1c044280d6cee759383f6db79bcac46cf8650bd8 (diff)
downloadseaweedfs-1040761ab682f63cbecdd70be08343bb934c3380.tar.xz
seaweedfs-1040761ab682f63cbecdd70be08343bb934c3380.zip
avoid herding effect by double checking
Diffstat (limited to 'go')
-rw-r--r--go/weed/benchmark.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/go/weed/benchmark.go b/go/weed/benchmark.go
index af5c70715..600ca781a 100644
--- a/go/weed/benchmark.go
+++ b/go/weed/benchmark.go
@@ -193,7 +193,7 @@ func writeFiles(idChan chan int, fileIdLineChan chan string, s *stats) {
func readFiles(fileIdLineChan chan string, s *stats) {
serverLimitChan := make(map[string]chan bool)
- masterLimitChan := make(chan bool, 7)
+ masterLimitChan := make(chan bool, 1)
for {
if fid, ok := <-fileIdLineChan; ok {
if len(fid) == 0 {
@@ -210,10 +210,12 @@ func readFiles(fileIdLineChan chan string, s *stats) {
start := time.Now()
if server, ok := b.vid2server[vid]; !ok {
masterLimitChan <- true
- if ret, err := operation.Lookup(*b.server, vid); err == nil {
- if len(ret.Locations) > 0 {
- server = ret.Locations[0].PublicUrl
- b.vid2server[vid] = server
+ if _, now_ok := b.vid2server[vid]; !now_ok {
+ if ret, err := operation.Lookup(*b.server, vid); err == nil {
+ if len(ret.Locations) > 0 {
+ server = ret.Locations[0].PublicUrl
+ b.vid2server[vid] = server
+ }
}
}
<-masterLimitChan