gopkg
gopkg copied to clipboard
fix: close consume chan when close in throttle waiting
Reproduction condition
- channel using consume throttle: eg
ch := channel.New(channel.WithRateThrottle(0, 1))
- have a goroutine block on
ch.Output()
- and then call ch.Close() in another goroutine
In such case, ch.Output() will not be triggered and this goroutine will be leak and block forever.
Reason
The root cause is when consume throttle recover, it forget to close channel and let output channel alive.