Browse Source

Merge pull request #6587 from heyitsanthony/watch-fix-revrace

clientv3: fix race on watch initial revision
Anthony Romano 9 years ago
parent
commit
f67f8d3b31
1 changed files with 1 additions and 1 deletions
  1. 1 1
      clientv3/watch.go

+ 1 - 1
clientv3/watch.go

@@ -573,7 +573,6 @@ func (w *watchGrpcStream) serveSubstream(ws *watcherStream, resumec chan struct{
 		if !resuming {
 		if !resuming {
 			ws.closing = true
 			ws.closing = true
 		}
 		}
-		ws.initReq.rev = nextRev
 		close(ws.donec)
 		close(ws.donec)
 		if !resuming {
 		if !resuming {
 			w.closingc <- ws
 			w.closingc <- ws
@@ -619,6 +618,7 @@ func (w *watchGrpcStream) serveSubstream(ws *watcherStream, resumec chan struct{
 			if len(wr.Events) > 0 {
 			if len(wr.Events) > 0 {
 				nextRev = wr.Events[len(wr.Events)-1].Kv.ModRevision + 1
 				nextRev = wr.Events[len(wr.Events)-1].Kv.ModRevision + 1
 			}
 			}
+			ws.initReq.rev = nextRev
 		case <-ws.initReq.ctx.Done():
 		case <-ws.initReq.ctx.Done():
 			return
 			return
 		case <-resumec:
 		case <-resumec: