From 220f4e652539b37850cbd494ffa4af147f2dc4db Mon Sep 17 00:00:00 2001 From: Timon Ringwald Date: Wed, 30 Mar 2022 15:23:47 +0200 Subject: [PATCH] fixed LimitedRunner behavior if runnable panics --- limited_runner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/limited_runner.go b/limited_runner.go index 75e4630..c571649 100644 --- a/limited_runner.go +++ b/limited_runner.go @@ -22,7 +22,7 @@ func NewLimitedRunner(routineLimit int) *LimitedRunner { func (r *LimitedRunner) Run(f func()) { r.limiter <- struct{}{} go func() { + defer func() { <-r.limiter }() f() - <-r.limiter }() }