Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Jan 13, 2025
1 parent f7f1af8 commit 2fb9d2b
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tools/pd-ctl/pdctl/command/config_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,8 @@ func postConfigDataWithPath(cmd *cobra.Command, key, value, path string) error {
val, err := strconv.ParseFloat(value, 64)
if err != nil {
val = value
}
if key == "max-replicas" {
checkMaxReplicas(cmd, val)
} else if key == "max-replicas" {
checkMaxReplicas(cmd, val.(float64))
}
data[key] = val
reqData, err := json.Marshal(data)
Expand All @@ -389,12 +388,7 @@ func postConfigDataWithPath(cmd *cobra.Command, key, value, path string) error {
return nil
}

func checkMaxReplicas(cmd *cobra.Command, value any) {
newReplica, ok := value.(float64)
if !ok {
// If the type is not float64, it will be handled elsewhere
return
}
func checkMaxReplicas(cmd *cobra.Command, newReplica float64) {
header := buildHeader(cmd)
r, err := doRequest(cmd, replicatePrefix, http.MethodGet, header)
if err != nil {
Expand Down

0 comments on commit 2fb9d2b

Please sign in to comment.