Skip to content
Snippets Groups Projects
Commit a9b7ca86 authored by benjamin's avatar benjamin
Browse files

fixed isready so the float doesnt go above 100

parent b5218334
No related branches found
No related tags found
2 merge requests!510Release,!432Control node reg
...@@ -484,8 +484,6 @@ func (c *Cmix) GetNodeRegistrationStatus() (int, int, error) { ...@@ -484,8 +484,6 @@ func (c *Cmix) GetNodeRegistrationStatus() (int, int, error) {
return numRegistered, len(nodes) - numStale, nil return numRegistered, len(nodes) - numStale, nil
} }
// IsReady returns true if at least percentReady of node registrations has // IsReady returns true if at least percentReady of node registrations has
// completed. If not all have completed, then it returns false and howClose will // completed. If not all have completed, then it returns false and howClose will
// be a percent (0-1) of node registrations completed. // be a percent (0-1) of node registrations completed.
...@@ -502,6 +500,9 @@ func (c *Cmix) IsReady(percentReady float64) (isReady bool, howClose float64) { ...@@ -502,6 +500,9 @@ func (c *Cmix) IsReady(percentReady float64) (isReady bool, howClose float64) {
isReady = (float64(numReg) / float64(numNodes)) >= percentReady isReady = (float64(numReg) / float64(numNodes)) >= percentReady
howClose = float64(numReg) / (float64(numNodes) * percentReady) howClose = float64(numReg) / (float64(numNodes) * percentReady)
if howClose > 1 {
howClose = 1
}
return isReady, howClose return isReady, howClose
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment