Dispatch save accepted ledger better.

This commit is contained in:
JoelKatz
2013-03-06 16:33:53 -08:00
parent 0e4b1e00a7
commit 6a298872cc
2 changed files with 6 additions and 5 deletions

View File

@@ -400,8 +400,8 @@ uint256 Ledger::getHash()
return mHash;
}
void Ledger::saveAcceptedLedger(bool fromConsensus, LoadEvent::pointer event)
{ // can be called in a different thread
void Ledger::saveAcceptedLedger(Job&, bool fromConsensus)
{
cLog(lsTRACE) << "saveAcceptedLedger " << (fromConsensus ? "fromConsensus " : "fromAcquire ") << getLedgerSeq();
static boost::format ledgerExists("SELECT LedgerSeq FROM Ledgers INDEXED BY SeqLedger where LedgerSeq = %d;");
static boost::format deleteLedger("DELETE FROM Ledgers WHERE LedgerSeq = %d;");
@@ -1530,8 +1530,8 @@ void Ledger::pendSave(bool fromConsensus)
++sPendingSaves;
}
boost::thread(boost::bind(&Ledger::saveAcceptedLedger, shared_from_this(), fromConsensus,
theApp->getJobQueue().getLoadEvent(jtDISK, fromConsensus ? "Ledger::cSave" : "Ledger::save"))).detach();
theApp->getJobQueue().addJob(jtPUBOLDLEDGER, // FIXME not old if fromConsensus
boost::bind(&Ledger::saveAcceptedLedger, shared_from_this(), _1, fromConsensus));
}

View File

@@ -19,6 +19,7 @@
#include "SHAMap.h"
#include "InstanceCounter.h"
#include "LoadMonitor.h"
#include "JobQueue.h"
enum LedgerStateParms
{
@@ -102,7 +103,7 @@ protected:
static void incPendingSaves();
static void decPendingSaves();
void saveAcceptedLedger(bool fromConsensus, LoadEvent::pointer);
void saveAcceptedLedger(Job&, bool fromConsensus);
void updateFees();
void zeroFees();