Browse Source

Merge pull request #6550 from heyitsanthony/watch-prog-notify

clientv3: make IsProgressNotify() false on compact event and closed channel
Anthony Romano 9 years ago
parent
commit
c349e089b1
2 changed files with 2 additions and 2 deletions
  1. 1 1
      clientv3/watch.go
  2. 1 1
      proxy/grpcproxy/watcher_group_test.go

+ 1 - 1
clientv3/watch.go

@@ -92,7 +92,7 @@ func (wr *WatchResponse) Err() error {
 
 // IsProgressNotify returns true if the WatchResponse is progress notification.
 func (wr *WatchResponse) IsProgressNotify() bool {
-	return len(wr.Events) == 0 && !wr.Canceled && !wr.Created
+	return len(wr.Events) == 0 && !wr.Canceled && !wr.Created && wr.CompactRevision == 0 && wr.Header.Revision != 0
 }
 
 // watcher implements the Watcher interface

+ 1 - 1
proxy/grpcproxy/watcher_group_test.go

@@ -40,7 +40,7 @@ func TestWatchgroupBroadcast(t *testing.T) {
 	}
 
 	// send a progress response
-	wch <- clientv3.WatchResponse{}
+	wch <- clientv3.WatchResponse{Header: pb.ResponseHeader{Revision: 1}}
 
 	for _, ch := range chs {
 		<-ch