mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
v3rpc: report eventReceived correctly
This commit is contained in:
@@ -66,10 +66,19 @@ func sendLoop(stream pb.Watch_WatchServer, watcher storage.Watcher, closec chan
|
||||
return
|
||||
}
|
||||
err := stream.Send(&pb.WatchResponse{Event: &e})
|
||||
storage.ReportEventReceived()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
case <-closec:
|
||||
// drain the chan to clean up pending events
|
||||
for {
|
||||
_, ok := <-watcher.Chan()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
storage.ReportEventReceived()
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user