Don't allow an unlimited amount of work to build up for the ledger accept engine.

This commit is contained in:
JoelKatz
2012-10-28 19:36:02 -07:00
parent c9a2482c95
commit 851d21a5aa
4 changed files with 45 additions and 5 deletions

View File

@@ -125,9 +125,8 @@ void LedgerMaster::missingAcquireComplete(LedgerAcquire::pointer acq)
if (!acq->isFailed())
{
boost::thread thread(boost::bind(&Ledger::saveAcceptedLedger, acq->getLedger(), false));
thread.detach();
setFullLedger(acq->getLedger());
acq->getLedger()->pendSave(false);
}
}
@@ -153,6 +152,12 @@ void LedgerMaster::setFullLedger(Ledger::ref ledger)
if (mMissingLedger || !theConfig.FULL_HISTORY)
return;
if (Ledger::getPendingSaves() > 2)
{
cLog(lsINFO) << "Too many pending ledger saves";
return;
}
// see if there's a ledger gap we need to fill
if (!mCompleteLedgers.hasValue(ledger->getLedgerSeq() - 1))
{