mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3: only update initReq.rev == 0 with creation watch revision
Always updating the initReq.rev on watch create will resume from the wrong revision if initReq is ever nonzero.
This commit is contained in:
parent
557abbe437
commit
30f4e36de4
@ -615,11 +615,20 @@ func (w *watchGrpcStream) serveSubstream(ws *watcherStream, resumec chan struct{
|
|||||||
// send first creation event only if requested
|
// send first creation event only if requested
|
||||||
if ws.initReq.createdNotify {
|
if ws.initReq.createdNotify {
|
||||||
ws.outc <- *wr
|
ws.outc <- *wr
|
||||||
|
if ws.initReq.rev == 0 {
|
||||||
|
// current revision of store; returning the
|
||||||
|
// create response binds the current revision to
|
||||||
|
// this revision, so restart with it if there's a
|
||||||
|
// disconnect before receiving any events.
|
||||||
|
nextRev = wr.Header.Revision
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// current progress of watch; <= store revision
|
||||||
|
nextRev = wr.Header.Revision
|
||||||
}
|
}
|
||||||
|
|
||||||
nextRev = wr.Header.Revision
|
|
||||||
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
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user