forked from I2P_Developers/i2p.i2p
Logs: Fix output of dup message after 30 minutes
This commit is contained in:
@ -29,6 +29,7 @@ abstract class LogWriter implements Runnable {
|
|||||||
|
|
||||||
protected volatile boolean _write;
|
protected volatile boolean _write;
|
||||||
private LogRecord _last;
|
private LogRecord _last;
|
||||||
|
private long _firstTimestamp;
|
||||||
// ms
|
// ms
|
||||||
private volatile long _flushInterval = FLUSH_INTERVAL;
|
private volatile long _flushInterval = FLUSH_INTERVAL;
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ abstract class LogWriter implements Runnable {
|
|||||||
Queue<LogRecord> records = _manager.getQueue();
|
Queue<LogRecord> records = _manager.getQueue();
|
||||||
if (records == null) return;
|
if (records == null) return;
|
||||||
if (!records.isEmpty()) {
|
if (!records.isEmpty()) {
|
||||||
if (_last != null && _last.getDate() < _manager.getContext().clock().now() - 30*60*1000)
|
if (_last != null && _firstTimestamp < _manager.getContext().clock().now() - 30*60*1000)
|
||||||
_last = null;
|
_last = null;
|
||||||
LogRecord rec;
|
LogRecord rec;
|
||||||
int dupCount = 0;
|
int dupCount = 0;
|
||||||
@ -108,6 +109,7 @@ abstract class LogWriter implements Runnable {
|
|||||||
dupCount = 0;
|
dupCount = 0;
|
||||||
}
|
}
|
||||||
writeRecord(rec);
|
writeRecord(rec);
|
||||||
|
_firstTimestamp = rec.getDate();
|
||||||
}
|
}
|
||||||
_last = rec;
|
_last = rec;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user