Skip to content

Commit

Permalink
address the comment
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Sep 5, 2023
1 parent 132dec5 commit 8f40ad6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ func (h *Handler) AddScheduler(name string, args ...string) error {
log.Error("can not add scheduler", zap.String("scheduler-name", s.GetName()), zap.Strings("scheduler-args", args), errs.ZapError(err))
return err
}
} else {
c.GetSchedulerConfig().AddSchedulerCfg(s.GetType(), args)
}
if err = h.opt.Persist(c.GetStorage()); err != nil {
log.Error("can not persist scheduler config", errs.ZapError(err))
Expand All @@ -264,6 +266,7 @@ func (h *Handler) RemoveScheduler(name string) error {
}
} else {
conf := c.GetSchedulerConfig()
c.GetSchedulerConfig().RemoveSchedulerCfg(schedulers.FindSchedulerTypeByName(name))
if err := conf.Persist(c.GetStorage()); err != nil {
log.Error("the option can not persist scheduler config", errs.ZapError(err))
return err
Expand Down
5 changes: 2 additions & 3 deletions tests/integrations/mcs/scheduling/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ func (suite *configTestSuite) TestSchedulerConfigWatch() {
)
re.NoError(err)
// Get all default scheduler names.
var (
schedulerNames, _, _ = suite.pdLeaderServer.GetRaftCluster().GetStorage().LoadAllScheduleConfig()
)
var schedulerNames, _, _ = suite.pdLeaderServer.GetRaftCluster().GetStorage().LoadAllScheduleConfig()

testutil.Eventually(re, func() bool {
targetCount := len(sc.DefaultSchedulers)
return len(schedulerNames) == targetCount
Expand Down

0 comments on commit 8f40ad6

Please sign in to comment.