mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-30 19:46:21 +08:00
fix: goroutine leak in Wait
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user