From 4bdfc0a46d28f35462a312e1b51a771764321442 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Sun, 27 Mar 2016 03:39:21 -0700 Subject: [PATCH] clientv3: fix race on writing watch channel over return channel Found in TestElectionFailover --- clientv3/watch.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clientv3/watch.go b/clientv3/watch.go index d9edd2b8c..fc49dd17e 100644 --- a/clientv3/watch.go +++ b/clientv3/watch.go @@ -240,11 +240,11 @@ func (w *watcher) addStream(resp *pb.WatchResponse, pendingReq *watchRequest) { w.streams[ws.id] = ws w.mu.Unlock() - // send messages to subscriber - go w.serveStream(ws) - // pass back the subscriber channel for the watcher pendingReq.retc <- ret + + // send messages to subscriber + go w.serveStream(ws) } // closeStream closes the watcher resources and removes it