Add new setting to determine how many blocks to sync before saving stats

This commit is contained in:
joeuhren
2020-12-08 20:49:06 -07:00
parent 4240178255
commit 120947fe42
4 changed files with 6 additions and 1 deletions
+1
View File
@@ -306,6 +306,7 @@ app.set('genesis_block', settings.genesis_block);
app.set('index', settings.index);
app.set('use_rpc', settings.use_rpc);
app.set('heavy', settings.heavy);
app.set('save_stats_after_sync_blocks', settings.save_stats_after_sync_blocks);
app.set('lock_during_index', settings.lock_during_index);
app.set('txcount', settings.txcount);
app.set('txcount_per_page', settings.txcount_per_page);
+1 -1
View File
@@ -808,7 +808,7 @@ module.exports = {
blocks_to_scan.push(i);
}
async.eachLimit(blocks_to_scan, task_limit_blocks, function(block_height, next_block) {
if (block_height % 5000 === 0) {
if (block_height % settings.save_stats_after_sync_blocks === 0) {
Stats.updateOne({coin: coin}, {
last: block_height - 1,
txes: txes,
+1
View File
@@ -159,6 +159,7 @@ exports.genesis_block = "0000860fcf946b44df0e7d85d6757d45f8de6f4c9aacc5c7b6abc13
exports.use_rpc = true;
exports.heavy = false;
exports.save_stats_after_sync_blocks = 100;
exports.lock_during_index = false;
exports.txcount = 100;
exports.txcount_per_page = 50;
+3
View File
@@ -180,6 +180,9 @@
//heavy (enable/disable additional heavy features)
"heavy": false,
//during index syncronization, stats are saved updated after processing this many blocks to save time
"save_stats_after_sync_blocks": 100,
//disable saving blocks & TXs via API during indexing.
"lock_during_index": false,