Round numbers

This commit is contained in:
Frank Denis 2019-06-03 17:10:38 +02:00
parent b63df9cdfa
commit 62e8d193c0
1 changed files with 2 additions and 2 deletions

View File

@ -179,11 +179,11 @@ func (serversInfo *ServersInfo) estimatorUpdate(candidate int) {
if candidateRtt < currentBestRtt { if candidateRtt < currentBestRtt {
serversInfo.inner[candidate], serversInfo.inner[0] = serversInfo.inner[0], serversInfo.inner[candidate] serversInfo.inner[candidate], serversInfo.inner[0] = serversInfo.inner[0], serversInfo.inner[candidate]
partialSort = true partialSort = true
dlog.Debugf("New preferred candidate: %v (rtt: %v vs previous: %v)", serversInfo.inner[0].Name, candidateRtt, currentBestRtt) dlog.Debugf("New preferred candidate: %v (rtt: %d vs previous: %d)", serversInfo.inner[0].Name, int(candidateRtt), int(currentBestRtt))
} else if candidateRtt > 0 && candidateRtt >= currentBestRtt*4.0 { } else if candidateRtt > 0 && candidateRtt >= currentBestRtt*4.0 {
if time.Since(serversInfo.inner[candidate].lastActionTS) > time.Duration(1*time.Minute) { if time.Since(serversInfo.inner[candidate].lastActionTS) > time.Duration(1*time.Minute) {
serversInfo.inner[candidate].rtt.Add(MinF(MaxF(candidateRtt/2.0, currentBestRtt*2.0), candidateRtt)) serversInfo.inner[candidate].rtt.Add(MinF(MaxF(candidateRtt/2.0, currentBestRtt*2.0), candidateRtt))
dlog.Debugf("Giving a new chance to candidate [%s], setting its RTT from %v to %v (best: %v)", serversInfo.inner[candidate].Name, candidateRtt, serversInfo.inner[candidate].rtt.Value(), currentBestRtt) dlog.Debugf("Giving a new chance to candidate [%s], setting its RTT from %d to %d (best: %d)", serversInfo.inner[candidate].Name, int(candidateRtt), int(serversInfo.inner[candidate].rtt.Value()), int(currentBestRtt))
partialSort = true partialSort = true
} }
} }