mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
benchmark: fix watch bench
This commit is contained in:
parent
a01f5a2786
commit
2bd5d66596
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user