Skip to content

Commit 5899d29

Browse files
committed
remove unnecessary check
1 parent c8ac3d6 commit 5899d29

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

api/helm-app/service/HelmAppService.go

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -174,29 +174,30 @@ func (impl *HelmAppServiceImpl) ListHelmApplications(ctx context.Context, cluste
174174
nil,
175175
http.StatusInternalServerError)
176176
return
177-
} else if len(clusterIds) > 0 {
178-
// get helm apps which are created using cd_pipelines
179-
newCtx, span := otel.Tracer("pipelineRepository").Start(ctx, "GetAppAndEnvDetailsForDeploymentAppTypePipeline")
177+
}
178+
179+
// get helm apps which are created using cd_pipelines
180+
newCtx, span := otel.Tracer("pipelineRepository").Start(ctx, "GetAppAndEnvDetailsForDeploymentAppTypePipeline")
181+
start = time.Now()
182+
helmCdPipelines, err = impl.pipelineRepository.GetAppAndEnvDetailsForDeploymentAppTypePipeline(util.PIPELINE_DEPLOYMENT_TYPE_HELM, clusterIds)
183+
middleware.AppListingDuration.WithLabelValues("getAppAndEnvDetailsForDeploymentAppTypePipeline", "helm").Observe(time.Since(start).Seconds())
184+
span.End()
185+
if err != nil {
186+
impl.logger.Errorw("error in fetching helm app list from DB created using cd_pipelines", "clusters", clusterIds, "err", err)
187+
}
188+
189+
// if not hyperion mode, then fetch from installed_apps whose deploymentAppType is helm (as in hyperion mode, these apps should be treated as external-apps)
190+
if !util2.IsBaseStack() {
191+
newCtx, span = otel.Tracer("pipelineRepository").Start(newCtx, "GetAppAndEnvDetailsForDeploymentAppTypePipeline")
180192
start = time.Now()
181-
helmCdPipelines, err = impl.pipelineRepository.GetAppAndEnvDetailsForDeploymentAppTypePipeline(util.PIPELINE_DEPLOYMENT_TYPE_HELM, clusterIds)
182-
middleware.AppListingDuration.WithLabelValues("getAppAndEnvDetailsForDeploymentAppTypePipeline", "helm").Observe(time.Since(start).Seconds())
193+
installedHelmApps, err = impl.installedAppRepository.GetAppAndEnvDetailsForDeploymentAppTypeInstalledApps(util.PIPELINE_DEPLOYMENT_TYPE_HELM, clusterIds)
194+
middleware.AppListingDuration.WithLabelValues("getAppAndEnvDetailsForDeploymentAppTypeInstalledApps", "helm").Observe(time.Since(start).Seconds())
183195
span.End()
184196
if err != nil {
185-
impl.logger.Errorw("error in fetching helm app list from DB created using cd_pipelines", "clusters", clusterIds, "err", err)
186-
}
187-
188-
// if not hyperion mode, then fetch from installed_apps whose deploymentAppType is helm (as in hyperion mode, these apps should be treated as external-apps)
189-
if !util2.IsBaseStack() {
190-
newCtx, span = otel.Tracer("pipelineRepository").Start(newCtx, "GetAppAndEnvDetailsForDeploymentAppTypePipeline")
191-
start = time.Now()
192-
installedHelmApps, err = impl.installedAppRepository.GetAppAndEnvDetailsForDeploymentAppTypeInstalledApps(util.PIPELINE_DEPLOYMENT_TYPE_HELM, clusterIds)
193-
middleware.AppListingDuration.WithLabelValues("getAppAndEnvDetailsForDeploymentAppTypeInstalledApps", "helm").Observe(time.Since(start).Seconds())
194-
span.End()
195-
if err != nil {
196-
impl.logger.Errorw("error in fetching helm app list from DB created from app store", "clusters", clusterIds, "err", err)
197-
}
197+
impl.logger.Errorw("error in fetching helm app list from DB created from app store", "clusters", clusterIds, "err", err)
198198
}
199199
}
200+
200201
impl.pump.StartStreamWithTransformer(w, func() (proto.Message, error) {
201202
return appStream.Recv()
202203
}, err,

0 commit comments

Comments
 (0)