mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
grpcproxy: watch next revision should be start revision when not 0
The create header revision is the current etcd revision. For watches with rev=0, the next revision is hdr.rev+1. For watches with rev=n, the next revision should be n. Fixes TestDoubleBarrier timeouts.
This commit is contained in:
parent
d073512def
commit
98a7c642d4
@ -81,7 +81,10 @@ func newWatchBroadcast(wp *watchProxy, w *watcher, update func(*watchBroadcast))
|
|||||||
func (wb *watchBroadcast) bcast(wr clientv3.WatchResponse) {
|
func (wb *watchBroadcast) bcast(wr clientv3.WatchResponse) {
|
||||||
wb.mu.Lock()
|
wb.mu.Lock()
|
||||||
defer wb.mu.Unlock()
|
defer wb.mu.Unlock()
|
||||||
wb.nextrev = wr.Header.Revision + 1
|
// watchers start on the given revision, if any; ignore header rev on create
|
||||||
|
if wb.responses > 0 || wb.nextrev == 0 {
|
||||||
|
wb.nextrev = wr.Header.Revision + 1
|
||||||
|
}
|
||||||
wb.responses++
|
wb.responses++
|
||||||
for r := range wb.receivers {
|
for r := range wb.receivers {
|
||||||
r.send(wr)
|
r.send(wr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user