when measuring capacity, consider data updated within the last hour as good, not just the last 5 minutes

This commit is contained in:
jrandom
2004-07-20 04:11:33 +00:00
committed by zzz
parent f06e21ff5a
commit ccb2600e67
2 changed files with 13 additions and 5 deletions

View File

@ -68,7 +68,7 @@ public class CapacityCalculator extends Calculator {
*
*/
private boolean tooOld(PeerProfile profile) {
if (profile.getIsActive())
if (profile.getIsActive(60*60*1000))
return false;
else
return true;

View File

@ -83,10 +83,18 @@ public class PeerProfile {
* 5 minutes)
*/
public boolean getIsActive() {
if ( (getSendSuccessSize().getRate(5*60*1000).getCurrentEventCount() > 0) ||
(getSendSuccessSize().getRate(5*60*1000).getLastEventCount() > 0) ||
(getReceiveSize().getRate(5*60*1000).getCurrentEventCount() > 0) ||
(getReceiveSize().getRate(5*60*1000).getLastEventCount() > 0) )
return getIsActive(5*60*1000);
}
/**
* Is this peer active at the moment (sending/receiving messages within the
* given period?)
*/
public boolean getIsActive(long period) {
if ( (getSendSuccessSize().getRate(period).getCurrentEventCount() > 0) ||
(getSendSuccessSize().getRate(period).getLastEventCount() > 0) ||
(getReceiveSize().getRate(period).getCurrentEventCount() > 0) ||
(getReceiveSize().getRate(period).getLastEventCount() > 0) )
return true;
else
return false;