Skip to content

Commit

Permalink
fix name & lint
Browse files Browse the repository at this point in the history
  • Loading branch information
buchuitoudegou committed Jul 19, 2022
1 parent bcec113 commit 0463e8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions dm/loader/lightning.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (l *LightningLoader) runLightning(ctx context.Context, cfg *lcfg.Config) er
return err
}

func (l *LightningLoader) setLightningConfig() (*lcfg.Config, error) {
func (l *LightningLoader) getLightningConfig() (*lcfg.Config, error) {
cfg := lcfg.NewConfig()
if err := cfg.LoadFromGlobal(l.lightningGlobalConfig); err != nil {
return nil, err
Expand Down Expand Up @@ -318,14 +318,19 @@ func (l *LightningLoader) restore(ctx context.Context) error {
if err = l.checkPointList.RegisterCheckPoint(ctx); err != nil {
return err
}
cfg, err := l.setLightningConfig()
var cfg *lcfg.Config
cfg, err = l.getLightningConfig()
if err != nil {
return err
}
err = l.runLightning(ctx, cfg)
if err == nil {
l.finish.Store(true)
err = l.checkPointList.UpdateStatus(ctx, lightningStatusFinished)
if err != nil {
l.logger.Error("failed to update checkpoint status", zap.Error(err))
return err
}
} else {
l.logger.Error("failed to runlightning", zap.Error(err))
}
Expand Down
2 changes: 1 addition & 1 deletion dm/loader/lightning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestSetLightningConfig(t *testing.T) {
},
}
l := NewLightning(stCfg, nil, "")
cfg, err := l.setLightningConfig()
cfg, err := l.getLightningConfig()
require.NoError(t, err)
require.Equal(t, stCfg.LoaderConfig.PoolSize, cfg.App.RegionConcurrency)
}

0 comments on commit 0463e8f

Please sign in to comment.