From: Peter Amstutz Date: Fri, 29 Mar 2019 18:28:01 +0000 (-0400) Subject: 15050: Need to make sure to raise the semaphore when we're done X-Git-Tag: 1.4.0~86^2~1 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/bcf51c36cb5044b6abc32cacf4b66391245cb919 15050: Need to make sure to raise the semaphore when we're done Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/services/crunch-dispatch-local/crunch-dispatch-local.go b/services/crunch-dispatch-local/crunch-dispatch-local.go index 36d149272f..62935447dd 100644 --- a/services/crunch-dispatch-local/crunch-dispatch-local.go +++ b/services/crunch-dispatch-local/crunch-dispatch-local.go @@ -153,7 +153,10 @@ func (lr *LocalRun) run(dispatcher *dispatch.Dispatcher, return } + defer func() { <-lr.concurrencyLimit }() + waitGroup.Add(1) + defer waitGroup.Done() cmd := exec.Command(*crunchRunCommand, uuid) cmd.Stdin = nil @@ -207,7 +210,6 @@ func (lr *LocalRun) run(dispatcher *dispatch.Dispatcher, delete(runningCmds, uuid) runningCmdsMutex.Unlock() } - waitGroup.Done() } // If the container is not finalized, then change it to "Cancelled".