mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #6587 from heyitsanthony/watch-fix-revrace
clientv3: fix race on watch initial revision
This commit is contained in:
commit
f67f8d3b31
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user