fixed LimitedRunner behavior if runnable panics

This commit is contained in:
Timon Ringwald 2022-03-30 15:23:47 +02:00
parent 15e4d83ab9
commit 220f4e6525

View File

@ -22,7 +22,7 @@ func NewLimitedRunner(routineLimit int) *LimitedRunner {
func (r *LimitedRunner) Run(f func()) { func (r *LimitedRunner) Run(f func()) {
r.limiter <- struct{}{} r.limiter <- struct{}{}
go func() { go func() {
defer func() { <-r.limiter }()
f() f()
<-r.limiter
}() }()
} }