benchmark: fix watch bench

This commit is contained in:
Xiang Li 2016-06-20 14:00:22 -07:00
parent a01f5a2786
commit 2bd5d66596

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