Skip to content

Commit

Permalink
fix stuck pipelines completion
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasparada committed Dec 3, 2021
1 parent 3f66cdd commit a9b8ffd
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/calyptia/get_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ func (config *config) fetchAllPipelines() ([]cloud.AggregatorPipeline, error) {
return err
}

if len(aa) == 0 {
return nil
}

g2, gctx2 := errgroup.WithContext(gctx)
for _, a := range aa {
a := a
Expand Down Expand Up @@ -143,6 +147,10 @@ func (config *config) fetchAllProjectPipelines(projectID string) ([]cloud.Aggreg
return nil, fmt.Errorf("could not prefetch aggregators: %w", err)
}

if len(aa) == 0 {
return nil, nil
}

var pipelines []cloud.AggregatorPipeline
var mu sync.Mutex

Expand All @@ -163,6 +171,10 @@ func (config *config) fetchAllProjectPipelines(projectID string) ([]cloud.Aggreg
})
}

if err := g.Wait(); err != nil {
return nil, err
}

var uniquePipelines []cloud.AggregatorPipeline
pipelineIDs := map[string]struct{}{}
for _, pip := range pipelines {
Expand All @@ -172,7 +184,7 @@ func (config *config) fetchAllProjectPipelines(projectID string) ([]cloud.Aggreg
}
}

return uniquePipelines, g.Wait()
return uniquePipelines, nil
}

func (config *config) completePipelines(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
Expand Down

0 comments on commit a9b8ffd

Please sign in to comment.