From 805d4cbd93f01b6f55a4d53870a9cfa3adb1adfb Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Fri, 2 Sep 2016 15:57:35 -0700 Subject: [PATCH] grpcproxy: fix double create event --- proxy/grpcproxy/watcher_groups.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/proxy/grpcproxy/watcher_groups.go b/proxy/grpcproxy/watcher_groups.go index 9a03b74278a..c999372481f 100644 --- a/proxy/grpcproxy/watcher_groups.go +++ b/proxy/grpcproxy/watcher_groups.go @@ -43,6 +43,14 @@ func (wgs *watchergroups) addWatcher(rid receiverID, w watcher) { rev := wg.add(rid, w) wgs.idToGroup[rid] = wg + if rev == 0 { + // The group is newly created, the create event has not been delivered + // to this group yet. + // We can rely on etcd server to deliver the create event. + // Or we might end up sending created event twice. + return + } + resp := &pb.WatchResponse{ Header: &pb.ResponseHeader{ // todo: fill in ClusterId