Skip to content

Commit

Permalink
fix invalidate
Browse files Browse the repository at this point in the history
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
  • Loading branch information
CabinfeverB committed Mar 16, 2022
1 parent 521e0b9 commit 4c08c71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/api/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ func (s *testScheduleSuite) TestAPI(c *C) {
})
c.Assert(err, NotNil)
c.Assert(err.Error(), Equals, "\"invalid batch size which should be an integer between 1 and 10\"\n")
resp = make(map[string]interface{})
c.Assert(readJSON(testDialClient, listURL, &resp), IsNil)
c.Assert(resp["batch"], Equals, 3.0)
// empty body
err = postJSON(testDialClient, updateURL, nil, func(res []byte, code int) {
c.Assert(code, Equals, 500)
Expand Down
1 change: 1 addition & 0 deletions server/schedulers/balance_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func (conf *balanceLeaderSchedulerConfig) Update(data []byte) (int, interface{})
newc, _ := json.Marshal(conf)
if !bytes.Equal(oldc, newc) {
if !conf.validate() {
json.Unmarshal(oldc, conf)
return http.StatusBadRequest, "invalid batch size which should be an integer between 1 and 10"
}
conf.persistLocked()
Expand Down

0 comments on commit 4c08c71

Please sign in to comment.