소스 검색

clientv3: register waitCancelSubstreams closingc goroutine with waitgroup

Fixes #7598
Anthony Romano 9 년 전
부모
커밋
aab2eda7df
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      clientv3/watch.go

+ 5 - 1
clientv3/watch.go

@@ -711,7 +711,11 @@ func (w *watchGrpcStream) waitCancelSubstreams(stopc <-chan struct{}) <-chan str
 				ws.closing = true
 				close(ws.outc)
 				ws.outc = nil
-				go func() { w.closingc <- ws }()
+				w.wg.Add(1)
+				go func() {
+					defer w.wg.Done()
+					w.closingc <- ws
+				}()
 			case <-stopc:
 			}
 		}(w.resuming[i])