fixed LimitedRunner behavior if runnable panics
This commit is contained in:
parent
15e4d83ab9
commit
220f4e6525
@ -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
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user