fix unreachable code

This commit is contained in:
Chris Lu 2019-10-21 22:36:41 -07:00
parent c262526d8a
commit d16c450682

View file

@ -2,7 +2,6 @@ package weed_server
import (
"context"
"errors"
"fmt"
"math/rand"
"net/http"
@ -68,7 +67,7 @@ func (ms *MasterServer) volumeGrowHandler(w http.ResponseWriter, r *http.Request
writeJsonError(w, r, http.StatusNotAcceptable, err)
return
}
if err == nil {
if count, err = strconv.Atoi(r.FormValue("count")); err == nil {
if ms.Topo.FreeSpace() < int64(count*option.ReplicaPlacement.GetCopyCount()) {
err = fmt.Errorf("only %d volumes left, not enough for %d", ms.Topo.FreeSpace(), count*option.ReplicaPlacement.GetCopyCount())
@ -76,9 +75,9 @@ func (ms *MasterServer) volumeGrowHandler(w http.ResponseWriter, r *http.Request
count, err = ms.vg.GrowByCountAndType(ms.grpcDialOpiton, count, option, ms.Topo)
}
} else {
err = errors.New("parameter count is not found")
}
err = fmt.Errorf("can not parse parameter count %s", r.FormValue("count"))
}
if err != nil {
writeJsonError(w, r, http.StatusNotAcceptable, err)
} else {