Skip to content

Commit

Permalink
chore: Update workflow controller initDB func (#11760)
Browse files Browse the repository at this point in the history
Signed-off-by: astraw99 <wangchengiscool@gmail.com>
  • Loading branch information
astraw99 authored Sep 6, 2023
1 parent 94fbb3b commit 595ab4b
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions workflow/controller/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (wfc *WorkflowController) updateConfig() error {
return err
}
log.Info("Persistence Session created successfully")

wfc.session = session
}
sqldb.ConfigureDBSession(wfc.session, persistence.ConnectionPool)
Expand Down Expand Up @@ -85,22 +84,16 @@ func (wfc *WorkflowController) updateConfig() error {
// initDB inits argo DB tables
func (wfc *WorkflowController) initDB() error {
persistence := wfc.Config.Persistence
if persistence != nil {
tableName, err := sqldb.GetTableName(persistence)
if err != nil {
return err
}
if !persistence.SkipMigration {
err = sqldb.NewMigrate(wfc.session, persistence.GetClusterName(), tableName).Exec(context.Background())
if err != nil {
return err
}
} else {
log.Info("DB migration is disabled")
}
if persistence == nil || persistence.SkipMigration {
log.Info("DB migration is disabled")
return nil
}
tableName, err := sqldb.GetTableName(persistence)
if err != nil {
return err
}

return nil
return sqldb.NewMigrate(wfc.session, persistence.GetClusterName(), tableName).Exec(context.Background())
}

func (wfc *WorkflowController) newRateLimiter() *rate.Limiter {
Expand Down

0 comments on commit 595ab4b

Please sign in to comment.