Call ProcessTick every second, handle tick cooldown inside (#2522)

This commit is contained in:
UdjinM6 2018-12-06 10:05:36 +03:00 committed by Alexander Block
parent 973a7f6dd6
commit 3a6bd8d235
2 changed files with 7 additions and 1 deletions

View File

@ -2078,7 +2078,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
if (!fLiteMode) {
scheduler.scheduleEvery(boost::bind(&CNetFulfilledRequestManager::DoMaintenance, boost::ref(netfulfilledman)), 60);
scheduler.scheduleEvery(boost::bind(&CMasternodeSync::DoMaintenance, boost::ref(masternodeSync), boost::ref(*g_connman)), MASTERNODE_SYNC_TICK_SECONDS);
scheduler.scheduleEvery(boost::bind(&CMasternodeSync::DoMaintenance, boost::ref(masternodeSync), boost::ref(*g_connman)), 1);
scheduler.scheduleEvery(boost::bind(&CMasternodeMan::DoMaintenance, boost::ref(mnodeman), boost::ref(*g_connman)), 1);
scheduler.scheduleEvery(boost::bind(&CActiveLegacyMasternodeManager::DoMaintenance, boost::ref(legacyActiveMasternodeManager), boost::ref(*g_connman)), MASTERNODE_MIN_MNP_SECONDS);

View File

@ -150,6 +150,12 @@ void CMasternodeSync::ProcessTick(CConnman& connman)
nTimeLastProcess = GetTime();
return;
}
if(GetTime() - nTimeLastProcess < MASTERNODE_SYNC_TICK_SECONDS) {
// too early, nothing to do here
return;
}
nTimeLastProcess = GetTime();
// reset sync status in case of any other sync failure