forked from I2P_Developers/i2p.i2p
2006-03-20 jrandom
* Fix to allow for some slack when coalescing stats
* Workaround some oddball errors
This commit is contained in:
@@ -180,12 +180,14 @@ public class Rate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 2s is plenty of slack to deal with slow coalescing (across many stats) */
|
||||||
|
private static final int SLACK = 2000;
|
||||||
public void coalesce() {
|
public void coalesce() {
|
||||||
long now = now();
|
long now = now();
|
||||||
synchronized (_lock) {
|
synchronized (_lock) {
|
||||||
long measuredPeriod = now - _lastCoalesceDate;
|
long measuredPeriod = now - _lastCoalesceDate;
|
||||||
if (measuredPeriod < _period) {
|
if (measuredPeriod < _period - SLACK) {
|
||||||
// no need to coalesce
|
// no need to coalesce (assuming we only try to do so once per minute)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user