mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Some performance tweaks.
This commit is contained in:
@@ -1037,6 +1037,9 @@ int Ledger::getPendingSaves()
|
||||
|
||||
void Ledger::pendSave(bool fromConsensus)
|
||||
{
|
||||
if (!fromConsensus && !theApp->isNew(getHash()))
|
||||
return;
|
||||
|
||||
boost::thread thread(boost::bind(&Ledger::saveAcceptedLedger, shared_from_this(), fromConsensus));
|
||||
thread.detach();
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ void LedgerMaster::setFullLedger(Ledger::ref ledger)
|
||||
if (mMissingLedger || !theConfig.FULL_HISTORY)
|
||||
return;
|
||||
|
||||
if (Ledger::getPendingSaves() > 2)
|
||||
if (Ledger::getPendingSaves() > 3)
|
||||
{
|
||||
cLog(lsINFO) << "Too many pending ledger saves";
|
||||
return;
|
||||
|
||||
@@ -41,6 +41,7 @@ void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint2
|
||||
stack.pop();
|
||||
|
||||
int base = rand() % 256;
|
||||
bool have_all = false;
|
||||
for (int ii = 0; ii < 16; ++ii)
|
||||
{ // traverse in semi-random order
|
||||
int branch = (base + ii) % 16;
|
||||
@@ -76,7 +77,8 @@ void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint2
|
||||
}
|
||||
if (!d)
|
||||
{ // we need this node
|
||||
nodeIDs.push_back(node->getChildNodeID(branch));
|
||||
have_all = false;
|
||||
nodeIDs.push_back(childID);
|
||||
if (--max <= 0)
|
||||
return;
|
||||
}
|
||||
@@ -84,6 +86,8 @@ void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint2
|
||||
stack.push(d);
|
||||
}
|
||||
}
|
||||
if (have_all)
|
||||
node->setFullBelow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user