Skip to content

Commit c86b395

Browse files
committed
updating tx
1 parent 35ce7c6 commit c86b395

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

env_gen.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

pkg/chart/ChartService.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,18 +430,18 @@ func (impl *ChartServiceImpl) CreateChartFromEnvOverride(ctx context.Context, te
430430
return nil, err
431431
}
432432

433-
currentLatestChart, err := impl.chartRepository.FindLatestChartForAppByAppId(nil, templateRequest.AppId)
434-
if err != nil && pg.ErrNoRows != err {
435-
return nil, err
436-
}
437-
438433
tx, err := impl.chartRepository.StartTx()
439434
if err != nil {
440435
impl.logger.Errorw("error in starting transaction to update charts", "error", err)
441436
return nil, err
442437
}
443438
defer impl.chartRepository.RollbackTx(tx)
444439

440+
currentLatestChart, err := impl.chartRepository.FindLatestChartForAppByAppId(tx, templateRequest.AppId)
441+
if err != nil && pg.ErrNoRows != err {
442+
return nil, err
443+
}
444+
445445
deploymentConfig, err := impl.deploymentConfigService.GetConfigForDevtronApps(tx, templateRequest.AppId, 0)
446446
if err != nil {
447447
impl.logger.Errorw("error in getting deployment config by appId", "appId", templateRequest.AppId, "err", err)

pkg/pipeline/PropertiesConfig.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ func (impl *PropertiesConfigServiceImpl) UpdateEnvironmentProperties(appId int,
367367
}
368368

369369
if !oldEnvOverride.Latest {
370-
envOverrideExisting, err := impl.envConfigOverrideReadService.FindLatestChartForAppByAppIdAndEnvId(nil, appId, oldEnvOverride.TargetEnvironment)
370+
envOverrideExisting, err := impl.envConfigOverrideReadService.FindLatestChartForAppByAppIdAndEnvId(tx, appId, oldEnvOverride.TargetEnvironment)
371371
if err != nil && !errors.IsNotFound(err) {
372372
return nil, err
373373
}
@@ -507,7 +507,7 @@ func (impl *PropertiesConfigServiceImpl) CreateIfRequired(request *bean.Environm
507507
if errors.IsNotFound(err) {
508508
if isOverride {
509509
// before creating new entry, remove previous one from latest tag
510-
envOverrideExisting, err := impl.envConfigOverrideReadService.FindLatestChartForAppByAppIdAndEnvId(nil, chart.AppId, environmentId)
510+
envOverrideExisting, err := impl.envConfigOverrideReadService.FindLatestChartForAppByAppIdAndEnvId(tx, chart.AppId, environmentId)
511511
if err != nil && !errors.IsNotFound(err) {
512512
return nil, isAppMetricsEnabled, err
513513
}
@@ -687,7 +687,7 @@ func (impl *PropertiesConfigServiceImpl) ResetEnvironmentProperties(id int, user
687687
return false, err
688688
}
689689

690-
chart, err := impl.chartRepo.FindLatestChartForAppByAppId(nil, envOverride.Chart.AppId)
690+
chart, err := impl.chartRepo.FindLatestChartForAppByAppId(tx, envOverride.Chart.AppId)
691691
if err != nil {
692692
impl.logger.Errorw("error in chartRefRepository.FindById", "chartRefId", envOverride.Chart.ChartRefId, "err", err)
693693
return false, err

0 commit comments

Comments
 (0)