Never run statistics when mempool not in sync.

This commit is contained in:
softsimon 2021-01-06 03:09:31 +07:00
parent 9e1ef1b747
commit 29dd6e5d8d
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

View File

@ -25,15 +25,15 @@ class Statistics {
setTimeout(() => { setTimeout(() => {
this.runStatistics(); this.runStatistics();
this.intervalTimer = setInterval(() => { this.intervalTimer = setInterval(() => {
if (!memPool.isInSync()) {
return;
}
this.runStatistics(); this.runStatistics();
}, 1 * 60 * 1000); }, 1 * 60 * 1000);
}, difference); }, difference);
} }
private async runStatistics(): Promise<void> { private async runStatistics(): Promise<void> {
if (!memPool.isInSync()) {
return;
}
const currentMempool = memPool.getMempool(); const currentMempool = memPool.getMempool();
const txPerSecond = memPool.getTxPerSecond(); const txPerSecond = memPool.getTxPerSecond();
const vBytesPerSecond = memPool.getVBytesPerSecond(); const vBytesPerSecond = memPool.getVBytesPerSecond();