From 0dc7613cbaa18fe7824b65eb0081d40469126e3b Mon Sep 17 00:00:00 2001 From: joeuhren <46763106+joeuhren@users.noreply.github.com> Date: Fri, 1 Jan 2021 18:33:53 -0700 Subject: [PATCH] Always do the check for and removal of sync msg --- scripts/sync.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/scripts/sync.js b/scripts/sync.js index a4ad210..1fa135f 100644 --- a/scripts/sync.js +++ b/scripts/sync.js @@ -320,18 +320,15 @@ if (database == 'peers') { console.log('index cleared (reindex)'); }); - // Check if there are more than 1000 blocks to index - var showSync = check_show_sync_message(stats.count); + // Check if there are more than 1000 blocks to index and show a sync msg + check_show_sync_message(stats.count); db.update_tx_db(settings.coin, 1, stats.count, stats.txes, settings.update_timeout, function() { db.update_richlist('received', function() { db.update_richlist('balance', function() { db.get_stats(settings.coin, function(nstats) { - // Check if the sync msg was showing - if (showSync) { - // Remove the sync msg - remove_sync_message(); - } + // always check for and remove the sync msg if exists + remove_sync_message(); // update richlist_last_updated value db.update_last_updated_stats(settings.coin, { richlist_last_updated: Math.floor(new Date() / 1000) }, function (cb) { // update blockchain_last_updated value @@ -361,18 +358,15 @@ if (database == 'peers') { var last = (stats.last ? stats.last : 0); // Get the total number of blocks var count = (stats.count ? stats.count : 0); - // Check if there are more than 1000 blocks to index - var showSync = check_show_sync_message(count - last); + // Check if there are more than 1000 blocks to index and show a sync msg + check_show_sync_message(count - last); db.update_tx_db(settings.coin, last, count, stats.txes, settings.update_timeout, function(){ db.update_richlist('received', function(){ db.update_richlist('balance', function(){ db.get_stats(settings.coin, function(nstats){ - // Check if the sync msg was showing - if (showSync) { - // Remove the sync msg - remove_sync_message(); - } + // always check for and remove the sync msg if exists + remove_sync_message(); // update richlist_last_updated value db.update_last_updated_stats(settings.coin, { richlist_last_updated: Math.floor(new Date() / 1000) }, function (cb) { // update blockchain_last_updated value