Lowering mempool loop break limit
This commit is contained in:
parent
5f787db30d
commit
31ae382f75
@ -156,7 +156,6 @@ class Mempool {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let loggerTimer = new Date().getTime() / 1000;
|
|
||||||
for (const txid of transactions) {
|
for (const txid of transactions) {
|
||||||
if (!this.mempoolCache[txid]) {
|
if (!this.mempoolCache[txid]) {
|
||||||
try {
|
try {
|
||||||
@ -179,18 +178,19 @@ class Mempool {
|
|||||||
logger.debug(`Error finding transaction '${txid}' in the mempool: ` + (e instanceof Error ? e.message : e));
|
logger.debug(`Error finding transaction '${txid}' in the mempool: ` + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const elapsedSeconds = Math.round((new Date().getTime() / 1000) - loggerTimer);
|
|
||||||
if (elapsedSeconds > 4) {
|
if (new Date().getTime() - start > 5_000) {
|
||||||
const progress = (currentMempoolSize + newTransactions.length) / transactions.length * 100;
|
const progress = (currentMempoolSize + newTransactions.length) / transactions.length * 100;
|
||||||
logger.debug(`Mempool is synchronizing. Processed ${newTransactions.length}/${diff} txs (${Math.round(progress)}%)`);
|
logger.debug(`Mempool is synchronizing. Processed ${newTransactions.length}/${diff} txs (${Math.round(progress)}%)`);
|
||||||
loadingIndicators.setProgress('mempool', progress);
|
|
||||||
loggerTimer = new Date().getTime() / 1000;
|
if (this.inSync) {
|
||||||
}
|
|
||||||
// Break and restart mempool loop if we spend too much time processing
|
// Break and restart mempool loop if we spend too much time processing
|
||||||
// new transactions that may lead to falling behind on block height
|
// new transactions that may lead to falling behind on block height
|
||||||
if (this.inSync && (new Date().getTime()) - start > 10_000) {
|
logger.debug('Breaking mempool loop because the 5s time limit exceeded.');
|
||||||
logger.debug('Breaking mempool loop because the 10s time limit exceeded.');
|
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
loadingIndicators.setProgress('mempool', progress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user