fix: goroutine leak in Wait

This commit is contained in:
gu18168
2021-07-25 13:37:10 +08:00
committed by finley
parent 5736345f0d
commit 9b78f554aa

View File

@@ -28,7 +28,7 @@ func (w *Wait) Wait() {
// WaitWithTimeout blocks until the WaitGroup counter is zero or timeout // WaitWithTimeout blocks until the WaitGroup counter is zero or timeout
// returns true if timeout // returns true if timeout
func (w *Wait) WaitWithTimeout(timeout time.Duration) bool { func (w *Wait) WaitWithTimeout(timeout time.Duration) bool {
c := make(chan bool) c := make(chan bool, 1)
go func() { go func() {
defer close(c) defer close(c)
w.wg.Wait() w.wg.Wait()