From 343748111aa479bd2d3298bd5c6da76c39e7b0e6 Mon Sep 17 00:00:00 2001 From: jrandom <jrandom> Date: Mon, 20 Mar 2006 05:39:54 +0000 Subject: [PATCH] 2006-03-20 jrandom * Fix to allow for some slack when coalescing stats * Workaround some oddball errors --- core/java/src/net/i2p/stat/Rate.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/java/src/net/i2p/stat/Rate.java b/core/java/src/net/i2p/stat/Rate.java index 1d7fae51b6..25508263f0 100644 --- a/core/java/src/net/i2p/stat/Rate.java +++ b/core/java/src/net/i2p/stat/Rate.java @@ -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() { long now = now(); synchronized (_lock) { long measuredPeriod = now - _lastCoalesceDate; - if (measuredPeriod < _period) { - // no need to coalesce + if (measuredPeriod < _period - SLACK) { + // no need to coalesce (assuming we only try to do so once per minute) return; } -- GitLab