Skip to content

Commit

Permalink
Limit parallel registration of pipelines
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Plakhotnikov <[email protected]>
  • Loading branch information
Kaspiman committed Aug 8, 2023
1 parent 2727f53 commit d1b85ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const (
PluginName string = "jobs"
pipelines string = "pipelines"

pipelinesRegisterConcurrencyLimit = 10

// v2.7 and newer config key
cfgKey string = "config"

Expand Down Expand Up @@ -149,7 +151,6 @@ func (p *Plugin) Serve() chan error {

// do not continue processing, immediately stop if channel contains an error
if len(errCh) > 0 {
p.log.Error("Pipelines initialization failed", zap.Time("start", start), zap.Duration("elapsed", time.Since(start)))
return errCh
}

Expand Down Expand Up @@ -568,6 +569,7 @@ func (p *Plugin) putPayload(pld *payload.Payload) {

func (p *Plugin) registerPipelines() error {
eg := &errgroup.Group{}
eg.SetLimit(pipelinesRegisterConcurrencyLimit)

p.pipelines.Range(func(key, value any) bool {
eg.Go(func() error {
Expand Down

0 comments on commit d1b85ca

Please sign in to comment.