From 9b78f554aa86ab724664e0e4bdfb0f51cf2df593 Mon Sep 17 00:00:00 2001 From: gu18168 Date: Sun, 25 Jul 2021 13:37:10 +0800 Subject: [PATCH] fix: goroutine leak in Wait --- lib/sync/wait/wait.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sync/wait/wait.go b/lib/sync/wait/wait.go index 5e0ecf2..1fb99a7 100644 --- a/lib/sync/wait/wait.go +++ b/lib/sync/wait/wait.go @@ -28,7 +28,7 @@ func (w *Wait) Wait() { // WaitWithTimeout blocks until the WaitGroup counter is zero or timeout // returns true if timeout func (w *Wait) WaitWithTimeout(timeout time.Duration) bool { - c := make(chan bool) + c := make(chan bool, 1) go func() { defer close(c) w.wg.Wait()