Browse Source

Merge pull request #7504 from heyitsanthony/fix-watch-wait

clientv3: close open watch channel if substream is closing on reconnect
Anthony Romano 8 years ago
parent
commit
7a6b61cd6f
1 changed files with 4 additions and 0 deletions
  1. 4 0
      clientv3/watch.go

+ 4 - 0
clientv3/watch.go

@@ -694,6 +694,10 @@ func (w *watchGrpcStream) waitCancelSubstreams(stopc <-chan struct{}) <-chan str
 		go func(ws *watcherStream) {
 			defer wg.Done()
 			if ws.closing {
+				if ws.initReq.ctx.Err() != nil && ws.outc != nil {
+					close(ws.outc)
+					ws.outc = nil
+				}
 				return
 			}
 			select {