Base concurrency on items parameter (#798)

Fixes #793
This commit is contained in:
Travis Groth 2019-08-07 21:20:05 -04:00 committed by KUOKA Yusuke
parent 6baad71b1f
commit 63a337ee57
1 changed files with 5 additions and 6 deletions

View File

@ -2,8 +2,9 @@ package state
import ( import (
"fmt" "fmt"
"github.com/roboll/helmfile/pkg/helmexec"
"sync" "sync"
"github.com/roboll/helmfile/pkg/helmexec"
) )
type result struct { type result struct {
@ -12,11 +13,9 @@ type result struct {
} }
func (st *HelmState) scatterGather(concurrency int, items int, produceInputs func(), receiveInputsAndProduceIntermediates func(int), aggregateIntermediates func()) { func (st *HelmState) scatterGather(concurrency int, items int, produceInputs func(), receiveInputsAndProduceIntermediates func(int), aggregateIntermediates func()) {
numReleases := len(st.Releases)
if concurrency < 1 { if concurrency < 1 || concurrency > items {
concurrency = numReleases concurrency = items
} else if concurrency > numReleases {
concurrency = numReleases
} }
for _, r := range st.Releases { for _, r := range st.Releases {