From 98a7c642d44ca1e87db84b1beb313e0dfd35c311 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Mon, 14 Nov 2016 16:42:27 -0800 Subject: [PATCH] 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. --- proxy/grpcproxy/watch_broadcast.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proxy/grpcproxy/watch_broadcast.go b/proxy/grpcproxy/watch_broadcast.go index a82c842fb..8c64b61c7 100644 --- a/proxy/grpcproxy/watch_broadcast.go +++ b/proxy/grpcproxy/watch_broadcast.go @@ -81,7 +81,10 @@ func newWatchBroadcast(wp *watchProxy, w *watcher, update func(*watchBroadcast)) func (wb *watchBroadcast) bcast(wr clientv3.WatchResponse) { wb.mu.Lock() 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++ for r := range wb.receivers { r.send(wr)