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

clientv3: fix race on watch initial revision
This commit is contained in:
Anthony Romano 2016-10-05 10:55:31 -07:00 committed by GitHub
commit f67f8d3b31

View File

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