Merge pull request #5729 from xiang90/fix_bench

benchmark: fix watch bench
release-3.0
Xiang Li 2016-06-20 16:02:09 -07:00 committed by GitHub
commit 1e0ff8555e
1 changed files with 6 additions and 4 deletions

View File

@ -197,12 +197,14 @@ func doWatch(stream v3.Watcher, requests <-chan string) {
}
func recvWatchChan(wch v3.WatchChan) {
for range wch {
for r := range wch {
st := time.Now()
results <- result{duration: time.Since(st), happened: time.Now()}
bar.Increment()
for range r.Events {
results <- result{duration: time.Since(st), happened: time.Now()}
bar.Increment()
atomic.AddInt32(&nrRecvCompleted, 1)
}
atomic.AddInt32(&nrRecvCompleted, 1)
if atomic.LoadInt32(&nrRecvCompleted) == int32(eventsTotal) {
recvCompletedNotifier <- struct{}{}
break